Read Jellyfin server and user from the environment
The helper scripts hardcoded a specific server address, account name and device identifier, which published private deployment details in a public repository. Both values are now required from JELLYFIN_URL and JELLYFIN_USER, and the scripts exit with usage text when either is unset.
This commit is contained in:
1 parent
36bd64092c
commit
fdf45691ae
2 files changed
+12
-6
No files matched your search
+6
-3
@@ -1,7 +1,10 @@
|
|||||||
import sys, json, time, urllib.request
|
import os, sys, json, time, urllib.request
|
||||||
BASE="http://192.168.50.1:30013"; USER="flan"
|
BASE = os.environ.get("JELLYFIN_URL")
|
||||||
|
USER = os.environ.get("JELLYFIN_USER")
|
||||||
|
if not BASE or not USER:
|
||||||
|
sys.exit("set JELLYFIN_URL and JELLYFIN_USER, e.g. JELLYFIN_URL=http://jellyfin.example:8096 JELLYFIN_USER=admin")
|
||||||
MYURL="https://git.arch.fyi/flan/jellyfin-placard/raw/branch/main/manifest.json"
|
MYURL="https://git.arch.fyi/flan/jellyfin-placard/raw/branch/main/manifest.json"
|
||||||
H='MediaBrowser Client="poster-pin", Device="code", DeviceId="poster-pin-code-8e1f", Version="1.0"'
|
H='MediaBrowser Client="poster-pin", Device="placard-tools", DeviceId="poster-pin-tools", Version="1.0"'
|
||||||
def call(p,m="GET",d=None,h=None):
|
def call(p,m="GET",d=None,h=None):
|
||||||
r=urllib.request.Request(BASE+p,data=d,method=m,headers=h or {})
|
r=urllib.request.Request(BASE+p,data=d,method=m,headers=h or {})
|
||||||
with urllib.request.urlopen(r,timeout=30) as x:
|
with urllib.request.urlopen(r,timeout=30) as x:
|
||||||
|
|||||||
+6
-3
@@ -1,9 +1,12 @@
|
|||||||
import sys, json, time, urllib.request, urllib.error
|
import os, sys, json, time, urllib.request, urllib.error
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
BASE="http://192.168.50.1:30013"; USER="flan"
|
BASE = os.environ.get("JELLYFIN_URL")
|
||||||
|
USER = os.environ.get("JELLYFIN_USER")
|
||||||
|
if not BASE or not USER:
|
||||||
|
sys.exit("set JELLYFIN_URL and JELLYFIN_USER, e.g. JELLYFIN_URL=http://jellyfin.example:8096 JELLYFIN_USER=admin")
|
||||||
GUID="b6f8e2a4-1c3d-4e5f-9a7b-2d4c6e8f0a1b"
|
GUID="b6f8e2a4-1c3d-4e5f-9a7b-2d4c6e8f0a1b"
|
||||||
MYURL="https://git.arch.fyi/flan/jellyfin-placard/raw/branch/main/manifest.json"
|
MYURL="https://git.arch.fyi/flan/jellyfin-placard/raw/branch/main/manifest.json"
|
||||||
H='MediaBrowser Client="poster-pin", Device="code", DeviceId="poster-pin-code-8e1f", Version="1.0"'
|
H='MediaBrowser Client="poster-pin", Device="placard-tools", DeviceId="poster-pin-tools", Version="1.0"'
|
||||||
def call(p,m="GET",d=None,h=None,t=30):
|
def call(p,m="GET",d=None,h=None,t=30):
|
||||||
r=urllib.request.Request(BASE+p,data=d,method=m,headers=h or {})
|
r=urllib.request.Request(BASE+p,data=d,method=m,headers=h or {})
|
||||||
with urllib.request.urlopen(r,timeout=t) as x:
|
with urllib.request.urlopen(r,timeout=t) as x:
|
||||||
|
|||||||
Reference in new issue
Block a user