storage.destroy()
This commit is contained in:
@@ -218,6 +218,7 @@ def apply_default_mods(reapply_current=False):
|
||||
continue
|
||||
|
||||
subs_applied += 1
|
||||
storage.destroy()
|
||||
Log.Debug("Applied mods to %i items" % subs_applied)
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ def ItemDetailsMenu(rating_key, title=None, base_title=None, item_title=None, ra
|
||||
))
|
||||
|
||||
add_ignore_options(oc, "videos", title=item_title, rating_key=rating_key, callback_menu=IgnoreMenu)
|
||||
subtitle_storage.destroy()
|
||||
|
||||
return oc
|
||||
|
||||
@@ -169,6 +170,8 @@ def SubtitleOptionsMenu(**kwargs):
|
||||
title=u"Modify %s subtitle" % kwargs["language_name"],
|
||||
summary=u"Currently applied mods: %s" % (", ".join(current_sub.mods) if current_sub.mods else "none")
|
||||
))
|
||||
|
||||
storage.destroy()
|
||||
return oc
|
||||
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ def SubtitleModificationsMenu(**kwargs):
|
||||
summary=u"Currently applied mods: %s" % (", ".join(current_mods) if current_mods else "none")
|
||||
))
|
||||
|
||||
storage.destroy()
|
||||
|
||||
return oc
|
||||
|
||||
|
||||
@@ -248,4 +250,6 @@ def SubtitleListMods(**kwargs):
|
||||
title="Remove: %s" % identifier
|
||||
))
|
||||
|
||||
storage.destroy()
|
||||
|
||||
return oc
|
||||
@@ -80,5 +80,6 @@ def migrate():
|
||||
if stored_any:
|
||||
subtitle_storage.save(stored_subs)
|
||||
|
||||
subtitle_storage.destroy()
|
||||
del Dict["subs"]
|
||||
Dict.Save()
|
||||
|
||||
@@ -373,6 +373,8 @@ def set_mods_for_part(rating_key, part_id, language, item_type, mods, mode="add"
|
||||
current_sub.encoding = "utf-8"
|
||||
storage.save(stored_subs)
|
||||
|
||||
storage.destroy()
|
||||
|
||||
subtitle.plex_media_fps = plex_part.fps
|
||||
subtitle.page_link = "modify subtitles with: %s" % (", ".join(current_sub.mods) if current_sub.mods else "none")
|
||||
subtitle.language = language
|
||||
|
||||
@@ -49,6 +49,7 @@ def store_subtitle_info(scanned_video_part_map, downloaded_subtitles, storage_ty
|
||||
|
||||
Log.Debug("Saving subtitle storage for %s" % video_id)
|
||||
subtitle_storage.save(stored_subs)
|
||||
subtitle_storage.destroy()
|
||||
|
||||
|
||||
def reset_storage(key):
|
||||
|
||||
@@ -330,6 +330,8 @@ class SearchAllRecentlyAddedMissing(Task):
|
||||
|
||||
viable_items[fn] = stored_subs
|
||||
|
||||
subtitle_storage.destroy()
|
||||
|
||||
self.items_searching = len(viable_items)
|
||||
|
||||
download_count = 0
|
||||
@@ -568,6 +570,8 @@ class FindBetterSubtitles(DownloadSubtitleMixin, SubtitleListingMixin, Task):
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
subtitle_storage.destroy()
|
||||
|
||||
if better_found:
|
||||
Log.Debug("Task: %s, done. Better subtitles found for %s/%s items", self.name, better_found,
|
||||
viable_item_count)
|
||||
@@ -591,6 +595,8 @@ class SubtitleStorageMaintenance(Task):
|
||||
else:
|
||||
Log.Info("Nothing to do")
|
||||
|
||||
storage.destroy()
|
||||
|
||||
|
||||
class MenuHistoryMaintenance(Task):
|
||||
periodic = True
|
||||
@@ -625,6 +631,8 @@ class MigrateSubtitleStorage(Task):
|
||||
Log.Debug("Migrating %s", fn)
|
||||
storage.load(None, fn)
|
||||
|
||||
storage.destroy()
|
||||
|
||||
|
||||
scheduler.register(SearchAllRecentlyAddedMissing)
|
||||
scheduler.register(AvailableSubsForItem)
|
||||
|
||||
@@ -323,6 +323,10 @@ class StoredSubtitlesManager(object):
|
||||
self.storage = storage
|
||||
self.get_item = plexapi_item_getter
|
||||
|
||||
def destroy(self):
|
||||
self.storage = None
|
||||
self.get_item = None
|
||||
|
||||
def get_storage_filename(self, video_id):
|
||||
return "subs_%s" % video_id
|
||||
|
||||
@@ -445,6 +449,7 @@ class StoredSubtitlesManager(object):
|
||||
# migrate to our new json format
|
||||
new_subs_for_video = JSONStoredVideoSubtitles()
|
||||
new_subs_for_video.deserialize(subs_for_video.__dict__)
|
||||
subs_for_video = None
|
||||
self.save(new_subs_for_video)
|
||||
|
||||
self.legacy_delete(from_fn)
|
||||
@@ -468,6 +473,7 @@ class StoredSubtitlesManager(object):
|
||||
return
|
||||
|
||||
subs_for_video.deserialize(data)
|
||||
data = None
|
||||
|
||||
elif not bare_fn.endswith(".json.gz") and os.path.exists(os.path.join(self.dataitems_path, bare_fn)):
|
||||
subs_for_video = self.migrate_legacy_data(bare_fn, json_path)
|
||||
|
||||
Reference in New Issue
Block a user