mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-22 01:23:43 +00:00
Change if a newly added show is not found on indexer, remove already created empty folder.
This commit is contained in:
parent
9b06d6d60f
commit
8aa2889537
4 changed files with 20 additions and 6 deletions
|
@ -136,6 +136,7 @@
|
||||||
* Add tip to search settings/media search about improved matching with optional regex library
|
* Add tip to search settings/media search about improved matching with optional regex library
|
||||||
* Change use value of "Update shows during hour" in General Settings straight after it is saved instead of after restart
|
* Change use value of "Update shows during hour" in General Settings straight after it is saved instead of after restart
|
||||||
* Change add tips for what to use for Growl notifications on Windows
|
* Change add tips for what to use for Growl notifications on Windows
|
||||||
|
* Change if a newly added show is not found on indexer, remove already created empty folder
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
import os
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ from sickbeard import name_cache
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
from sickbeard.helpers import should_delete_episode
|
from sickbeard.helpers import should_delete_episode
|
||||||
from sickbeard.blackandwhitelist import BlackAndWhiteList
|
from sickbeard.blackandwhitelist import BlackAndWhiteList
|
||||||
|
from sickbeard import encodingKludge as ek
|
||||||
|
|
||||||
|
|
||||||
class ShowQueue(generic_queue.GenericQueue):
|
class ShowQueue(generic_queue.GenericQueue):
|
||||||
|
@ -175,10 +177,10 @@ class ShowQueue(generic_queue.GenericQueue):
|
||||||
|
|
||||||
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
|
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
|
||||||
lang='en', subtitles=None, anime=None, scene=None, paused=None, blacklist=None, whitelist=None,
|
lang='en', subtitles=None, anime=None, scene=None, paused=None, blacklist=None, whitelist=None,
|
||||||
wanted_begin=None, wanted_latest=None, tag=None):
|
wanted_begin=None, wanted_latest=None, tag=None, new_show=False):
|
||||||
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
|
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
|
||||||
subtitles, anime, scene, paused, blacklist, whitelist,
|
subtitles, anime, scene, paused, blacklist, whitelist,
|
||||||
wanted_begin, wanted_latest, tag)
|
wanted_begin, wanted_latest, tag, new_show=new_show)
|
||||||
|
|
||||||
self.add_item(queueItemObj)
|
self.add_item(queueItemObj)
|
||||||
|
|
||||||
|
@ -235,7 +237,8 @@ class ShowQueueItem(generic_queue.QueueItem):
|
||||||
|
|
||||||
class QueueItemAdd(ShowQueueItem):
|
class QueueItemAdd(ShowQueueItem):
|
||||||
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
|
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
|
||||||
scene, paused, blacklist, whitelist, default_wanted_begin, default_wanted_latest, tag, scheduled_update=False):
|
scene, paused, blacklist, whitelist, default_wanted_begin, default_wanted_latest, tag,
|
||||||
|
scheduled_update=False, new_show=False):
|
||||||
|
|
||||||
self.indexer = indexer
|
self.indexer = indexer
|
||||||
self.indexer_id = indexer_id
|
self.indexer_id = indexer_id
|
||||||
|
@ -253,6 +256,7 @@ class QueueItemAdd(ShowQueueItem):
|
||||||
self.blacklist = blacklist
|
self.blacklist = blacklist
|
||||||
self.whitelist = whitelist
|
self.whitelist = whitelist
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
|
self.new_show = new_show
|
||||||
|
|
||||||
self.show = None
|
self.show = None
|
||||||
|
|
||||||
|
@ -482,9 +486,16 @@ class QueueItemAdd(ShowQueueItem):
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
def _finishEarly(self):
|
def _finishEarly(self):
|
||||||
if self.show != None:
|
if self.show is not None:
|
||||||
self.show.deleteShow()
|
self.show.deleteShow()
|
||||||
|
|
||||||
|
if self.new_show:
|
||||||
|
# if we adding a new show, delete the empty folder that was already created
|
||||||
|
try:
|
||||||
|
ek.ek(os.rmdir, self.showDir)
|
||||||
|
except (StandardError, Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2095,7 +2095,7 @@ class CMD_ShowAddNew(ApiCall):
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus,
|
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus,
|
||||||
newQuality,
|
newQuality,
|
||||||
int(self.flatten_folders), self.lang, self.subtitles, self.anime,
|
int(self.flatten_folders), self.lang, self.subtitles, self.anime,
|
||||||
self.scene) # @UndefinedVariable
|
self.scene, new_show=True) # @UndefinedVariable
|
||||||
|
|
||||||
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
return _responds(RESULT_SUCCESS, {"name": indexerName}, indexerName + " has been queued to be added")
|
||||||
|
|
||||||
|
|
|
@ -3655,8 +3655,10 @@ class NewHomeAddShows(Home):
|
||||||
# use the whole path if it's given, or else append the show name to the root dir to get the full show path
|
# use the whole path if it's given, or else append the show name to the root dir to get the full show path
|
||||||
if fullShowPath:
|
if fullShowPath:
|
||||||
show_dir = ek.ek(os.path.normpath, fullShowPath)
|
show_dir = ek.ek(os.path.normpath, fullShowPath)
|
||||||
|
new_show = False
|
||||||
else:
|
else:
|
||||||
show_dir = ek.ek(os.path.join, rootDir, helpers.sanitizeFileName(show_name))
|
show_dir = ek.ek(os.path.join, rootDir, helpers.sanitizeFileName(show_name))
|
||||||
|
new_show = True
|
||||||
|
|
||||||
# blanket policy - if the dir exists you should have used 'add existing show' numbnuts
|
# blanket policy - if the dir exists you should have used 'add existing show' numbnuts
|
||||||
if ek.ek(os.path.isdir, show_dir) and not fullShowPath:
|
if ek.ek(os.path.isdir, show_dir) and not fullShowPath:
|
||||||
|
@ -3704,7 +3706,7 @@ class NewHomeAddShows(Home):
|
||||||
sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), newQuality,
|
sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), newQuality,
|
||||||
flatten_folders, indexerLang, subtitles, anime,
|
flatten_folders, indexerLang, subtitles, anime,
|
||||||
scene, None, blacklist, whitelist,
|
scene, None, blacklist, whitelist,
|
||||||
wanted_begin, wanted_latest, tag) # @UndefinedVariable
|
wanted_begin, wanted_latest, tag, new_show=new_show) # @UndefinedVariable
|
||||||
# ui.notifications.message('Show added', 'Adding the specified show into ' + show_dir)
|
# ui.notifications.message('Show added', 'Adding the specified show into ' + show_dir)
|
||||||
|
|
||||||
return finishAddShow()
|
return finishAddShow()
|
||||||
|
|
Loading…
Reference in a new issue