Commit 558684cc authored by Alexandre Beloin's avatar Alexandre Beloin

Merge branch 'develop'

parents 495b040f 42d360ed
......@@ -26,10 +26,14 @@ codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else No
import time
import signal
import sys
import shutil
import subprocess
import traceback
import shutil
import lib.shutil_custom
shutil.copyfile = lib.shutil_custom.copyfile_custom
if sys.version_info < (2, 6):
print "Sorry, requires Python 2.6 or 2.7."
sys.exit(1)
......
This diff was suppressed by a .gitattributes entry.
......@@ -83,6 +83,16 @@
</label>
</div>
<div class="field-pair">
<label for="update_shows_on_snatch">
<span class="component-title">Update shows on snatch</span>
<span class="component-desc">
<input type="checkbox" name="update_shows_on_snatch" id="update_shows_on_snatch" #if $sickbeard.UPDATE_SHOWS_ON_SNATCH then 'checked="checked"' else ''#/>
<p>with information such as next air dates, show ended, etc.</p>
</span>
</label>
</div>
<div class="field-pair">
<span class="component-title">Send to trash for actions</span>
<span class="component-desc">
......@@ -334,7 +344,7 @@
<span class="component-title">Browser video player</span>
<span class="component-desc">
<input type="checkbox" name="play_videos" id="play_videos" #if $sickbeard.PLAY_VIDEOS then 'checked="checked"' else ''#/>
<p>play video files from display show page<?p>
<p>play video files from display show page</p>
</span>
</label>
</div>
......@@ -568,14 +578,29 @@
<span class="component-title">Branch version:</span>
<span class="component-desc">
<select id="branchVersion" class="form-control form-control-inline input-sm pull-left">
#if $sickbeard.versionCheckScheduler.action.list_remote_branches()
#for $cur_branch in $sickbeard.versionCheckScheduler.action.list_remote_branches():
<option value="$cur_branch" #if $cur_branch == $sickbeard.BRANCH then 'selected="selected"' else ''#>$cur_branch</option>
#end for
#set $gh_branch = $sickbeard.versionCheckScheduler.action.list_remote_branches()
#if $gh_branch:
#for $cur_branch in $gh_branch:
#if $sickbeard.GIT_USERNAME and $sickbeard.GIT_PASSWORD and $sickbeard.DEVELOPER == 1
<option value="$cur_branch" #if $cur_branch == $sickbeard.BRANCH then 'selected="selected"' else ''#>$cur_branch</option>
#else if $sickbeard.GIT_USERNAME and $sickbeard.GIT_PASSWORD and $cur_branch in ['master', 'develop']
<option value="$cur_branch" #if $cur_branch == $sickbeard.BRANCH then 'selected="selected"' else ''#>$cur_branch</option>
#else if $cur_branch == 'master'
<option value="$cur_branch" #if $cur_branch == $sickbeard.BRANCH then 'selected="selected"' else ''#>$cur_branch</option>
#end if
#end for
#end if
</select>
<input class="btn btn-inline" style="margin-left: 6px;" type="button" id="branchCheckout" value="Checkout Branch">
<div class="clear-left"><p>select branch to use (restart required)</p></div>
#if not $gh_branch
<input class="btn btn-inline" style="margin-left: 6px;" type="button" id="branchCheckout" value="Checkout Branch" disabled>
#else
<input class="btn btn-inline" style="margin-left: 6px;" type="button" id="branchCheckout" value="Checkout Branch">
#end if
#if not $gh_branch
<div class="clear-left" style="color:#FF0000"><p>Error: No branches found.</p></div>
#else
<div class="clear-left"><p>select branch to use (restart required)</p></div>
#end if
</span>
</label>
</div>
......@@ -630,11 +655,11 @@
</label>
</div>
<div class="field-pair">
<div class="field-pair" hidden>
<label for="git_autoissues">
<span class="component-title">Git auto-issues submit</span>
<span class="component-desc">
<input type="checkbox" name="git_autoissues" id="git_autoissues" #if True == $sickbeard.GIT_AUTOISSUES then 'checked="checked"' else ''#/>
<input type="checkbox" name="git_autoissues" id="git_autoissues" #if True == $sickbeard.GIT_AUTOISSUES then 'checked="checked"' else ''# disable/>
<p>automatically submit bug/issue reports to our issue tracker when errors are logged</p>
</span>
</label>
......
......@@ -1444,15 +1444,16 @@
</label>
</div>
<div class="field-pair">
<label for="trakt_use_watchlist">
<span class="component-title">Use watchlist:</span>
<label for="trakt_sync_watchlist">
<span class="component-title">Sync watchlist:</span>
<span class="component-desc">
<input type="checkbox" class="enabler" name="trakt_use_watchlist" id="trakt_use_watchlist" #if $sickbeard.TRAKT_USE_WATCHLIST then "checked=\"checked\"" else ""# />
<p>get new shows from your trakt watchlist.</p>
<input type="checkbox" class="enabler" name="trakt_sync_watchlist" id="trakt_sync_watchlist" #if $sickbeard.TRAKT_SYNC_WATCHLIST then "checked=\"checked\"" else ""# />
<p>sync your SickRage show watchlist with your trakt show watchlist (either Show and Episode).</p>
<p>Episode will be added on watch list when wanted or snatched and will be removed when downloaded </p>
</span>
</label>
</div>
<div id="content_trakt_use_watchlist">
<div id="content_trakt_sync_watchlist">
<div class="field-pair">
<label for="trakt_method_add">
<span class="component-title">Watchlist add method:</span>
......
......@@ -37,7 +37,7 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<!--
\$(document).ready(function(){
#for $curTorrentRssProvider in $sickbeard.torrentRssProviderList:
\$(this).addTorrentRssProvider('$curTorrentRssProvider.getID()', '$curTorrentRssProvider.name', '$curTorrentRssProvider.url', '$curTorrentRssProvider.cookies');
\$(this).addTorrentRssProvider('$curTorrentRssProvider.getID()', '$curTorrentRssProvider.name', '$curTorrentRssProvider.url', '$curTorrentRssProvider.cookies', '$curTorrentRssProvider.titleTAG');
#end for
});
//-->
......@@ -688,7 +688,16 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<span class="component-desc">eg. uid=xx;pass=yy</span>
</label>
</div>
<div class="field-pair">
<label for="torrentrss_titleTAG">
<span class="component-title">Search element:</span>
<input type="text" id="torrentrss_titleTAG" class="form-control input-sm input200" value="title"/>
</label>
<label>
<span class="component-title">&nbsp;</span>
<span class="component-desc">eg: title</span>
</label>
</div>
<div id="torrentrss_add_div">
<input type="button" class="btn torrentrss_save" id="torrentrss_add" value="Add" />
</div>
......
......@@ -384,7 +384,13 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
<div class="show-date">
#if $cur_airs_next
#set $ldatetime = $sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network))
<span class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdate($ldatetime)</span>
<span class="${fuzzydate}">
#try
$sbdatetime.sbdatetime.sbfdate($ldatetime)
#except ValueError
Invalid date
#end try
</span>
#else
#set $output_html = '?'
#if None is not $display_status
......@@ -536,7 +542,13 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
#if $cur_airs_next
#set $ldatetime = $sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network))
<td align="center" class="nowrap"><div class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdate($ldatetime)</div><span class="sort_data">$calendar.timegm($ldatetime.timetuple())</span></td>
<td align="center" class="nowrap"><div class="${fuzzydate}">
#try
$sbdatetime.sbdatetime.sbfdate($ldatetime)
#except ValueError
Invalid date
#end try
</div><span class="sort_data">$calendar.timegm($ldatetime.timetuple())</span></td>
#else:
<td align="center" class="nowrap"></td>
#end if
......
......@@ -90,7 +90,7 @@
\$("#SubMenu a:contains('Clear History')").addClass('btn clearhistory').html('<span class="ui-icon ui-icon-trash pull-left"></span> Clear History');
\$("#SubMenu a:contains('Trim History')").addClass('btn trimhistory').html('<span class="ui-icon ui-icon-trash pull-left"></span> Trim History');
\$("#SubMenu a[href$='/errorlogs/clearerrors/']").addClass('btn').html('<span class="ui-icon ui-icon-trash pull-left"></span> Clear Errors');
#if sickbeard.GIT_USERNAME and sickbeard.GIT_PASSWORD and sickbeard.GIT_AUTOISSUES == 1:
#if sickbeard.GIT_USERNAME and sickbeard.GIT_PASSWORD:
\$("#SubMenu a[href$='/errorlogs/submit_errors/']").addClass('btn').html('<span class="ui-icon ui-icon-arrowreturnthick-1-n pull-left"></span> Submit Errors');
#end if
\$("#SubMenu a:contains('Re-scan')").addClass('btn').html('<span class="ui-icon ui-icon-refresh pull-left"></span> Re-scan');
......@@ -253,7 +253,13 @@
</span>
</div>
#end if
#if $sickbeard.BRANCH and $sickbeard.BRANCH != 'master' and not $sickbeard.DEVELOPER
<div class="alert alert-danger upgrade-notification" role="alert">
<span>You're using the $sickbeard.BRANCH branch. Please use 'master' unless specifically asked</span>
</div>
#end if
#if $sickbeard.NEWEST_VERSION_STRING:
<div class="alert alert-success upgrade-notification" role="alert">
<span>$sickbeard.NEWEST_VERSION_STRING</span>
......
......@@ -46,25 +46,22 @@
#end if
#set $totalWanted = 0
#set $totalQual = 0
#set $totalSnatched = 0
#for $curShow in $sickbeard.showList:
#set $totalWanted = $totalWanted + $showCounts[$curShow.indexerid][$Overview.WANTED]
#set $totalQual = $totalQual + $showCounts[$curShow.indexerid][$Overview.QUAL]
#set $totalSnatched = $totalSnatched + $showCounts[$curShow.indexerid][$Overview.SNATCHED]
#end for
<div class="h2footer pull-right">
<span class="listing-key wanted">Wanted: <b>$totalWanted</b></span>
<span class="listing-key qual">Low Quality: <b>$totalQual</b></span>
<span class="listing-key snatched">Snatched: <b>$totalSnatched</b></span>
</div><br/>
<div class="float-left">
Jump to Show
<select id="pickShow" class="form-control form-control-inline input-sm">
#for $curShow in sorted($sickbeard.showList, key = operator.attrgetter('name')):
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] + $showCounts[$curShow.indexerid][$Overview.SNATCHED] != 0:
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] != 0:
<option value="$curShow.indexerid">$curShow.name</option>
#end if
#end for
......@@ -75,7 +72,7 @@ Jump to Show
#for $curShow in sorted($sickbeard.showList, key = operator.attrgetter('name')):
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] + $showCounts[$curShow.indexerid][$Overview.SNATCHED] == 0:
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] == 0:
#continue
#end if
......@@ -85,7 +82,6 @@ Jump to Show
<div class="pull-right">
<span class="listing-key wanted">Wanted: <b>$showCounts[$curShow.indexerid][$Overview.WANTED]</b></span>
<span class="listing-key qual">Low Quality: <b>$showCounts[$curShow.indexerid][$Overview.QUAL]</b></span>
<span class="listing-key snatched">Snatched: <b>$showCounts[$curShow.indexerid][$Overview.SNATCHED]</b></span>
<a class="btn btn-inline forceBacklog" href="$sbRoot/manage/backlogShow?indexer_id=$curShow.indexerid"><i class="icon-play-circle icon-white"></i> Force Backlog</a>
</div>
</td>
......@@ -101,7 +97,7 @@ Jump to Show
#continue
#end try
#if $overview not in ($Overview.QUAL, $Overview.WANTED, $Overview.SNATCHED):
#if $overview not in ($Overview.QUAL, $Overview.WANTED):
#continue
#end if
......
......@@ -80,9 +80,9 @@ $(document).ready(function(){
}
$.fn.addTorrentRssProvider = function (id, name, url, cookies) {
$.fn.addTorrentRssProvider = function (id, name, url, cookies, titleTAG) {
var newData = [name, url, cookies];
var newData = [name, url, cookies, titleTAG];
torrentRssProviders[id] = newData;
$('#editATorrentRssProvider').addOption(id, name);
......@@ -122,9 +122,10 @@ $(document).ready(function(){
}
$.fn.updateTorrentRssProvider = function (id, url, cookies) {
$.fn.updateTorrentRssProvider = function (id, url, cookies, titleTAG) {
torrentRssProviders[id][1] = url;
torrentRssProviders[id][2] = cookies;
torrentRssProviders[id][3] = titleTAG;
$(this).populateTorrentRssSection();
$(this).makeTorrentRssProviderString();
}
......@@ -277,7 +278,7 @@ $(document).ready(function(){
var selectedProvider = $('#editATorrentRssProvider :selected').val();
if (selectedProvider == 'addTorrentRss') {
var data = ['','',''];
var data = ['','','','title'];
$('#torrentrss_add_div').show();
$('#torrentrss_update_div').hide();
} else {
......@@ -289,15 +290,18 @@ $(document).ready(function(){
$('#torrentrss_name').val(data[0]);
$('#torrentrss_url').val(data[1]);
$('#torrentrss_cookies').val(data[2]);
$('#torrentrss_titleTAG').val(data[3]);
if (selectedProvider == 'addTorrentRss') {
$('#torrentrss_name').removeAttr("disabled");
$('#torrentrss_url').removeAttr("disabled");
$('#torrentrss_cookies').removeAttr("disabled");
$('#torrentrss_titleTAG').removeAttr("disabled");
} else {
$('#torrentrss_name').attr("disabled", "disabled");
$('#torrentrss_url').removeAttr("disabled");
$('#torrentrss_cookies').removeAttr("disabled");
$('#torrentrss_titleTAG').removeAttr("disabled");
$('#torrentrss_delete').removeAttr("disabled");
}
......@@ -386,7 +390,7 @@ $(document).ready(function(){
});
$('#torrentrss_url,#torrentrss_cookies').change(function(){
$('#torrentrss_url,#torrentrss_cookies,#torrentrss_titleTAG').change(function(){
var selectedProvider = $('#editATorrentRssProvider :selected').val();
......@@ -395,8 +399,9 @@ $(document).ready(function(){
var url = $('#torrentrss_url').val();
var cookies = $('#torrentrss_cookies').val();
var titleTAG = $('#torrentrss_titleTAG').val();
$(this).updateTorrentRssProvider(selectedProvider, url, cookies);
$(this).updateTorrentRssProvider(selectedProvider, url, cookies, titleTAG);
});
$('body').on('change', '#editAProvider',function(){
......@@ -504,7 +509,8 @@ $(document).ready(function(){
var name = $('#torrentrss_name').val();
var url = $('#torrentrss_url').val();
var cookies = $('#torrentrss_cookies').val();
var params = { name: name, url: url, cookies: cookies}
var titleTAG = $('#torrentrss_titleTAG').val();
var params = { name: name, url: url, cookies: cookies, titleTAG: titleTAG}
// send to the form with ajax, get a return value
$.getJSON(sbRoot + '/config/providers/canAddTorrentRssProvider', params,
......@@ -514,7 +520,7 @@ $(document).ready(function(){
return;
}
$(this).addTorrentRssProvider(data.success, name, url, cookies);
$(this).addTorrentRssProvider(data.success, name, url, cookies, titleTAG);
$(this).refreshEditAProvider();
});
});
......
import os
import platform
import stat
try:
from shutil import SpecialFileError, Error
except:
from shutil import Error
from shutil import _samefile
def copyfile_custom(src, dst):
"""Copy data from src to dst"""
if _samefile(src, dst):
raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
st = os.stat(fn)
except OSError:
# File most likely does not exist
pass
else:
# XXX What about other special files? (sockets, devices...)
if stat.S_ISFIFO(st.st_mode):
try:
raise SpecialFileError("`%s` is a named pipe" % fn)
except NameError:
raise Error("`%s` is a named pipe" % fn)
try:
# Windows
O_BINARY = os.O_BINARY
except:
O_BINARY = 0
READ_FLAGS = os.O_RDONLY | O_BINARY
WRITE_FLAGS = os.O_WRONLY | os.O_CREAT | os.O_TRUNC | O_BINARY
BUFFER_SIZE = 128*1024
try:
fin = os.open(src, READ_FLAGS)
fout = os.open(dst, WRITE_FLAGS)
for x in iter(lambda: os.read(fin, BUFFER_SIZE), ""):
os.write(fout, x)
except Exception as e:
raise e
finally:
try:
os.close(fin)
os.close(fout)
except:
pass
......@@ -3,7 +3,6 @@ import urllib
import ConfigParser
import sys
import os
import shutil
import zipfile
import subprocess
import fnmatch
......@@ -11,6 +10,11 @@ import googlecode_upload
from distutils.core import setup
import shutil
import lib.shutil_custom
shutil.copyfile = lib.shutil_custom.copyfile_custom
try:
import py2exe
except:
......
......@@ -25,6 +25,9 @@ import os
import re
import os.path
import shutil
import lib.shutil_custom
shutil.copyfile = lib.shutil_custom.copyfile_custom
from threading import Lock
import sys
......@@ -35,7 +38,7 @@ from sickbeard import providers, metadata, config, webserveInit
from sickbeard.providers.generic import GenericProvider
from providers import ezrss, btn, newznab, womble, thepiratebay, oldpiratebay, torrentleech, kat, iptorrents, \
omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, nextgen, speedcd, nyaatorrents, fanzub, torrentbytes, animezb, \
freshontv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage
freshontv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, \
naming_ep_type
from sickbeard import searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, \
......@@ -124,6 +127,7 @@ GIT_USERNAME = None
GIT_PASSWORD = None
GIT_PATH = None
GIT_AUTOISSUES = False
DEVELOPER = False
INIT_LOCK = Lock()
started = False
......@@ -170,6 +174,7 @@ CACHE_DIR = None
ACTUAL_CACHE_DIR = None
ROOT_DIRS = None
UPDATE_SHOWS_ON_START = False
UPDATE_SHOWS_ON_SNATCH = False
TRASH_REMOVE_SHOW = False
TRASH_ROTATE_LOGS = False
SORT_ARTICLE = False
......@@ -261,6 +266,8 @@ NZBS_HASH = None
WOMBLE = False
BINSEARCH = False
OMGWTFNZBS = False
OMGWTFNZBS_USERNAME = None
OMGWTFNZBS_APIKEY = None
......@@ -405,7 +412,7 @@ TRAKT_USERNAME = None
TRAKT_PASSWORD = None
TRAKT_REMOVE_WATCHLIST = False
TRAKT_REMOVE_SERIESLIST = False
TRAKT_USE_WATCHLIST = False
TRAKT_SYNC_WATCHLIST = False
TRAKT_METHOD_ADD = 0
TRAKT_START_PAUSED = False
TRAKT_USE_RECOMMENDED = False
......@@ -516,10 +523,10 @@ def initialize(consoleLogging=True):
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_LABEL_ANIME, TORRENT_VERIFY_CERT, TORRENT_RPCURL, TORRENT_AUTH_TYPE, \
USE_KODI, KODI_ALWAYS_ON, KODI_NOTIFY_ONSNATCH, KODI_NOTIFY_ONDOWNLOAD, KODI_NOTIFY_ONSUBTITLEDOWNLOAD, KODI_UPDATE_FULL, KODI_UPDATE_ONLYFIRST, \
KODI_UPDATE_LIBRARY, KODI_HOST, KODI_USERNAME, KODI_PASSWORD, BACKLOG_FREQUENCY, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, TRAKT_DISABLE_SSL_VERIFY, TRAKT_TIMEOUT, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_REMOVE_WATCHLIST, TRAKT_SYNC_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, TRAKT_DISABLE_SSL_VERIFY, TRAKT_TIMEOUT, \
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_SERVER_TOKEN, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, SORT_ARTICLE, showList, loadingShowList, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, UPDATE_SHOWS_ON_SNATCH, TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, SORT_ARTICLE, showList, loadingShowList, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, INDEXER_TIMEOUT, USENET_RETENTION, TORRENT_DIR, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, DAILYSEARCH_STARTUP, \
GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, USE_FREEMOBILE, FREEMOBILE_ID, FREEMOBILE_APIKEY, FREEMOBILE_NOTIFY_ONSNATCH, FREEMOBILE_NOTIFY_ONDOWNLOAD, FREEMOBILE_NOTIFY_ONSUBTITLEDOWNLOAD, \
......@@ -533,7 +540,7 @@ def initialize(consoleLogging=True):
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, TIMEZONE_DISPLAY, \
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_ANIME_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_SPORTS_PATTERN, NAMING_CUSTOM_SPORTS, NAMING_ANIME_PATTERN, NAMING_CUSTOM_ANIME, NAMING_STRIP_YEAR, \
RENAME_EPISODES, AIRDATE_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList, \
WOMBLE, BINSEARCH, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList, \
EXTRA_SCRIPTS, USE_TWITTER, TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_PREFIX, DAILYSEARCH_FREQUENCY, \
USE_BOXCAR, BOXCAR_USERNAME, BOXCAR_PASSWORD, BOXCAR_NOTIFY_ONDOWNLOAD, BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR_NOTIFY_ONSNATCH, \
USE_BOXCAR2, BOXCAR2_ACCESSTOKEN, BOXCAR2_NOTIFY_ONDOWNLOAD, BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR2_NOTIFY_ONSNATCH, \
......@@ -551,7 +558,7 @@ def initialize(consoleLogging=True):
AUTOPOSTPROCESSER_FREQUENCY, SHOWUPDATE_HOUR, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \
ANIME_DEFAULT, NAMING_ANIME, ANIMESUPPORT, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \
ANIME_SPLIT_HOME, SCENE_DEFAULT, PLAY_VIDEOS, DOWNLOAD_URL, BACKLOG_DAYS, GIT_ORG, GIT_REPO, GIT_USERNAME, GIT_PASSWORD, \
GIT_AUTOISSUES, gh
GIT_AUTOISSUES, DEVELOPER, gh
if __INITIALIZED__:
return False
......@@ -583,6 +590,7 @@ def initialize(consoleLogging=True):
# git login info
GIT_USERNAME = check_setting_str(CFG, 'General', 'git_username', '')
GIT_PASSWORD = check_setting_str(CFG, 'General', 'git_password', '', censor_log=True)
DEVELOPER = bool(check_setting_int(CFG, 'General', 'developer', 0))
# debugging
DEBUG = bool(check_setting_int(CFG, 'General', 'debug', 0))
......@@ -718,6 +726,7 @@ def initialize(consoleLogging=True):
ANON_REDIRECT = ''
UPDATE_SHOWS_ON_START = bool(check_setting_int(CFG, 'General', 'update_shows_on_start', 0))
UPDATE_SHOWS_ON_SNATCH = bool(check_setting_int(CFG, 'General', 'update_shows_on_snatch', 0))
TRASH_REMOVE_SHOW = bool(check_setting_int(CFG, 'General', 'trash_remove_show', 0))
TRASH_ROTATE_LOGS = bool(check_setting_int(CFG, 'General', 'trash_rotate_logs', 0))
......@@ -972,7 +981,7 @@ def initialize(consoleLogging=True):
TRAKT_PASSWORD = check_setting_str(CFG, 'Trakt', 'trakt_password', '', censor_log=True)
TRAKT_REMOVE_WATCHLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_remove_watchlist', 0))
TRAKT_REMOVE_SERIESLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_remove_serieslist', 0))
TRAKT_USE_WATCHLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_use_watchlist', 0))
TRAKT_SYNC_WATCHLIST = bool(check_setting_int(CFG, 'Trakt', 'trakt_sync_watchlist', 0))
TRAKT_METHOD_ADD = check_setting_int(CFG, 'Trakt', 'trakt_method_add', 0)
TRAKT_START_PAUSED = bool(check_setting_int(CFG, 'Trakt', 'trakt_start_paused', 0))
TRAKT_USE_RECOMMENDED = bool(check_setting_int(CFG, 'Trakt', 'trakt_use_recommended', 0))
......@@ -1502,7 +1511,7 @@ def save_config():
new_config['General'] = {}
new_config['General']['git_autoissues'] = int(GIT_AUTOISSUES)
new_config['General']['git_username'] = GIT_USERNAME
new_config['General']['git_password'] = GIT_PASSWORD
new_config['General']['git_password'] = helpers.encrypt(GIT_PASSWORD, ENCRYPTION_VERSION)
new_config['General']['git_reset'] = int(GIT_RESET)
new_config['General']['branch'] = BRANCH
new_config['General']['git_remote'] = GIT_REMOTE
......@@ -1575,6 +1584,7 @@ def save_config():
new_config['General']['naming_anime'] = int(NAMING_ANIME)
new_config['General']['launch_browser'] = int(LAUNCH_BROWSER)
new_config['General']['update_shows_on_start'] = int(UPDATE_SHOWS_ON_START)
new_config['General']['update_shows_on_snatch'] = int(UPDATE_SHOWS_ON_SNATCH)
new_config['General']['trash_remove_show'] = int(TRASH_REMOVE_SHOW)
new_config['General']['trash_rotate_logs'] = int(TRASH_ROTATE_LOGS)
new_config['General']['sort_article'] = int(SORT_ARTICLE)
......@@ -1614,6 +1624,7 @@ def save_config():
new_config['General']['ignore_words'] = IGNORE_WORDS
new_config['General']['require_words'] = REQUIRE_WORDS
new_config['General']['calendar_unprotected'] = int(CALENDAR_UNPROTECTED)
new_config['General']['developer'] = int(DEVELOPER)
new_config['Blackhole'] = {}
new_config['Blackhole']['nzb_dir'] = NZB_DIR
......@@ -1865,7 +1876,7 @@ def save_config():
new_config['Trakt']['trakt_password'] = helpers.encrypt(TRAKT_PASSWORD, ENCRYPTION_VERSION)
new_config['Trakt']['trakt_remove_watchlist'] = int(TRAKT_REMOVE_WATCHLIST)
new_config['Trakt']['trakt_remove_serieslist'] = int(TRAKT_REMOVE_SERIESLIST)
new_config['Trakt']['trakt_use_watchlist'] = int(TRAKT_USE_WATCHLIST)
new_config['Trakt']['trakt_sync_watchlist'] = int(TRAKT_SYNC_WATCHLIST)
new_config['Trakt']['trakt_method_add'] = int(TRAKT_METHOD_ADD)
new_config['Trakt']['trakt_start_paused'] = int(TRAKT_START_PAUSED)
new_config['Trakt']['trakt_use_recommended'] = int(TRAKT_USE_RECOMMENDED)
......
......@@ -22,7 +22,6 @@ import os
import ctypes
import random
import re
import shutil
import socket
import stat
import tempfile
......@@ -58,6 +57,11 @@ from sickbeard import clients
from cachecontrol import CacheControl, caches
from itertools import izip, cycle
import shutil
import lib.shutil_custom
shutil.copyfile = lib.shutil_custom.copyfile_custom
urllib._urlopener = classes.SickBeardURLopener()
......@@ -349,12 +353,8 @@ def listMediaFiles(path):
return files
def copyFile(srcFile, destFile):
if isPosix():
subprocess.call(['cp', srcFile, destFile])
else:
ek.ek(shutil.copyfile, srcFile, destFile)
def copyFile(srcFile, destFile):
ek.ek(shutil.copyfile, srcFile, destFile)
try:
ek.ek(shutil.copymode, srcFile, destFile)
except OSError:
......@@ -378,12 +378,6 @@ def link(src, dst):
else:
os.link(src, dst)
def isPosix():
if os.name.startswith('posix'):
return True
else:
return False
def hardlinkFile(srcFile, destFile):
try:
......@@ -923,7 +917,7 @@ def _check_against_names(nameInQuestion, show, season=-1):
return False
def get_show(name, tryIndexers=False):
def get_show(name, tryIndexers=False, trySceneExceptions=False):
if not sickbeard.showList:
return
......@@ -936,11 +930,18 @@ def get_show(name, tryIndexers=False):
if cache:
fromCache = True
showObj = findCertainShow(sickbeard.showList, int(cache))
#try indexers
if not showObj and tryIndexers:
showObj = findCertainShow(sickbeard.showList,
searchIndexerForShowID(full_sanitizeSceneName(name), ui=classes.ShowListUI)[2])
#try scene exceptions
if not showObj and trySceneExceptions:
ShowID = sickbeard.scene_exceptions.get_scene_exception_by_name(name)[0]
if ShowID:
showObj = findCertainShow(sickbeard.showList, int(ShowID))
# add show to cache
if showObj and not fromCache:
sickbeard.name_cache.addNameToCache(name, showObj.indexerid)
......
......@@ -131,7 +131,7 @@ class Mede8erMetadata(mediabrowser.MediaBrowserMetadata):
# check for title and id
try:
if myShow['seriesname'] == None or myShow['seriesname'] == "" or myShow['id'] == None or myShow['id'] == "":
if getattr(myShow, 'seriesname',