Formatting

pull/195/head
Luis Garcia 2024-08-28 17:14:37 -06:00
parent 066f9d1f66
commit 27797cb361
4 changed files with 30 additions and 28 deletions

View File

@ -20,6 +20,6 @@ class Emby(JellyfinEmby):
super().__init__( super().__init__(
server_type="Emby", baseurl=baseurl, token=token, headers=headers server_type="Emby", baseurl=baseurl, token=token, headers=headers
) )
def is_partial_update_supported(self, server_version): def is_partial_update_supported(self, server_version):
return server_version > version.parse("4.4") return server_version > version.parse("4.4")

View File

@ -1,6 +1,7 @@
from src.jellyfin_emby import JellyfinEmby from src.jellyfin_emby import JellyfinEmby
from packaging import version from packaging import version
class Jellyfin(JellyfinEmby): class Jellyfin(JellyfinEmby):
def __init__(self, baseurl, token): def __init__(self, baseurl, token):
authorization = ( authorization = (
@ -19,6 +20,6 @@ class Jellyfin(JellyfinEmby):
super().__init__( super().__init__(
server_type="Jellyfin", baseurl=baseurl, token=token, headers=headers server_type="Jellyfin", baseurl=baseurl, token=token, headers=headers
) )
def is_partial_update_supported(self, server_version): def is_partial_update_supported(self, server_version):
return server_version >= version.parse("10.9.0") return server_version >= version.parse("10.9.0")

View File

@ -26,6 +26,7 @@ load_dotenv(override=True)
generate_guids = str_to_bool(os.getenv("GENERATE_GUIDS", "True")) generate_guids = str_to_bool(os.getenv("GENERATE_GUIDS", "True"))
generate_locations = str_to_bool(os.getenv("GENERATE_LOCATIONS", "True")) generate_locations = str_to_bool(os.getenv("GENERATE_LOCATIONS", "True"))
def get_guids(server_type, item): def get_guids(server_type, item):
if item.get("Name"): if item.get("Name"):
guids = {"title": item.get("Name")} guids = {"title": item.get("Name")}
@ -194,10 +195,10 @@ class JellyfinEmby:
def get_server_version(self): def get_server_version(self):
try: try:
response = self.query('/System/Info/Public', 'get') response = self.query("/System/Info/Public", "get")
if response: if response:
return version.parse(response['Version']) return version.parse(response["Version"])
else: else:
return None return None
@ -756,10 +757,10 @@ class JellyfinEmby:
try: try:
server_version = self.get_server_version() server_version = self.get_server_version()
update_partial = self.is_partial_update_supported(server_version) update_partial = self.is_partial_update_supported(server_version)
if not update_partial: if not update_partial:
logger( logger(
f"{self.server_type}: Server version {server_version} does not support updating playback position.", f"{self.server_type}: Server version {server_version} does not support updating playback position.",
2, 2,
) )
@ -835,13 +836,13 @@ class JellyfinEmby:
if library_id: if library_id:
self.update_user_watched( self.update_user_watched(
user_name, user_name,
user_id, user_id,
library, library,
library_id, library_id,
videos, videos,
update_partial, update_partial,
dryrun dryrun,
) )
except Exception as e: except Exception as e:

View File

@ -90,25 +90,25 @@ def main():
] ]
expected_emby = [ expected_emby = [
"jellyplex_watched/Movies/Tears of Steel", "jellyplex_watched/Movies/Tears of Steel",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath", "jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429", "jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
"JellyUser/Movies/Tears of Steel", "JellyUser/Movies/Tears of Steel",
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4", "JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
] ]
expected_plex = [ expected_plex = [
"JellyUser/Movies/Big Buck Bunny", "JellyUser/Movies/Big Buck Bunny",
"JellyUser/Movies/Killers of the Flower Moon/4", "JellyUser/Movies/Killers of the Flower Moon/4",
"JellyUser/Shows/Doctor Who/The Unquiet Dead", "JellyUser/Shows/Doctor Who/The Unquiet Dead",
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4", "JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies", "JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4", "JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
"jellyplex_watched/Movies/Big Buck Bunny", "jellyplex_watched/Movies/Big Buck Bunny",
"jellyplex_watched/Movies/The Family Plan", "jellyplex_watched/Movies/The Family Plan",
"jellyplex_watched/Movies/Killers of the Flower Moon/4", "jellyplex_watched/Movies/Killers of the Flower Moon/4",
"jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead", "jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
"jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4", "jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies", "jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out", "jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
] ]
expected_dry = expected_emby + expected_plex + expected_jellyfin expected_dry = expected_emby + expected_plex + expected_jellyfin