mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-06 03:18:01 -05:00
Added a timezone display option so that you can either display the date/time via your local timezone or the show's network timezone.
This commit is contained in:
parent
5453c8c6df
commit
58e0b58a0f
@ -359,7 +359,18 @@
|
|||||||
<option value="$cur_preset" #if $cur_preset == $sickbeard.TIME_PRESET_W_SECONDS then "selected=\"selected\"" else ""#>$sbdatetime.now().sbftime(show_seconds=True,t_preset=$cur_preset)</option>
|
<option value="$cur_preset" #if $cur_preset == $sickbeard.TIME_PRESET_W_SECONDS then "selected=\"selected\"" else ""#>$sbdatetime.now().sbftime(show_seconds=True,t_preset=$cur_preset)</option>
|
||||||
#end for
|
#end for
|
||||||
</select>
|
</select>
|
||||||
<b>Note:</b> Seconds are only shown on the History Page.
|
</span>
|
||||||
|
<span class="component-desc"><b>Note:</b> Seconds are only shown on the History Page.</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-pair">
|
||||||
|
<label class="nocheck clearfix">
|
||||||
|
<span class="component-title">Timezones:</span>
|
||||||
|
<span class="component-desc">Display Dates and Times in either your timezone or the shows network timezone?</span>
|
||||||
|
<span class="component-desc">
|
||||||
|
<input type="radio" name="timezone_display" id="local" value="local" class="radio" #if $sickbeard.TIMEZONE_DISPLAY=="local" then "checked=\"checked\"" else ""# />Local Timezone<br />
|
||||||
|
<input type="radio" name="timezone_display" id="network" value="network" class="radio" #if $sickbeard.TIMEZONE_DISPLAY=="network" then "checked=\"checked\"" else ""# />Network Timezone<br />
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -271,7 +271,7 @@
|
|||||||
#end if
|
#end if
|
||||||
$epResult["name"]
|
$epResult["name"]
|
||||||
</td>
|
</td>
|
||||||
<td align="center" class="nowrap">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network,True))#</td>
|
<td align="center" class="nowrap">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network))#</td>
|
||||||
<td class="filename"><small>
|
<td class="filename"><small>
|
||||||
#if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()):
|
#if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()):
|
||||||
#set $epLoc = os.path.basename($epLoc[len($show._location)+1:])
|
#set $epLoc = os.path.basename($epLoc[len($show._location)+1:])
|
||||||
|
@ -388,6 +388,7 @@ COMING_EPS_MISSED_RANGE = None
|
|||||||
DATE_PRESET = None
|
DATE_PRESET = None
|
||||||
TIME_PRESET = None
|
TIME_PRESET = None
|
||||||
TIME_PRESET_W_SECONDS = None
|
TIME_PRESET_W_SECONDS = None
|
||||||
|
TIMEZONE_DISPLAY = None
|
||||||
|
|
||||||
USE_SUBTITLES = False
|
USE_SUBTITLES = False
|
||||||
SUBTITLES_LANGUAGES = []
|
SUBTITLES_LANGUAGES = []
|
||||||
@ -437,7 +438,7 @@ def initialize(consoleLogging=True):
|
|||||||
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
||||||
versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \
|
versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \
|
||||||
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, DEFAULT_UPDATE_FREQUENCY, MIN_UPDATE_FREQUENCY, UPDATE_FREQUENCY, \
|
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, DEFAULT_UPDATE_FREQUENCY, MIN_UPDATE_FREQUENCY, UPDATE_FREQUENCY, \
|
||||||
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, \
|
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, TIMEZONE_DISPLAY, \
|
||||||
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_SPORTS_PATTERN, NAMING_CUSTOM_SPORTS, NAMING_STRIP_YEAR, \
|
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_SPORTS_PATTERN, NAMING_CUSTOM_SPORTS, NAMING_STRIP_YEAR, \
|
||||||
RENAME_EPISODES, AIRDATE_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
|
RENAME_EPISODES, AIRDATE_EPISODES, properFinderScheduler, PROVIDER_ORDER, autoPostProcesserScheduler, \
|
||||||
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList, \
|
WOMBLE, OMGWTFNZBS, OMGWTFNZBS_USERNAME, OMGWTFNZBS_APIKEY, providerList, newznabProviderList, torrentRssProviderList, \
|
||||||
@ -857,6 +858,7 @@ def initialize(consoleLogging=True):
|
|||||||
DATE_PRESET = check_setting_str(CFG, 'GUI', 'date_preset', '%x')
|
DATE_PRESET = check_setting_str(CFG, 'GUI', 'date_preset', '%x')
|
||||||
TIME_PRESET_W_SECONDS = check_setting_str(CFG, 'GUI', 'time_preset', '%I:%M:%S %p')
|
TIME_PRESET_W_SECONDS = check_setting_str(CFG, 'GUI', 'time_preset', '%I:%M:%S %p')
|
||||||
TIME_PRESET = TIME_PRESET_W_SECONDS.replace(u":%S", u"")
|
TIME_PRESET = TIME_PRESET_W_SECONDS.replace(u":%S", u"")
|
||||||
|
TIMEZONE_DISPLAY = check_setting_str(CFG, 'GUI', 'timezone_display', 'network')
|
||||||
|
|
||||||
NEWZNAB_DATA = check_setting_str(CFG, 'Newznab', 'newznab_data', '')
|
NEWZNAB_DATA = check_setting_str(CFG, 'Newznab', 'newznab_data', '')
|
||||||
newznabProviderList = providers.getNewznabProviderList(NEWZNAB_DATA)
|
newznabProviderList = providers.getNewznabProviderList(NEWZNAB_DATA)
|
||||||
@ -1645,6 +1647,7 @@ def save_config():
|
|||||||
new_config['GUI']['coming_eps_missed_range'] = int(COMING_EPS_MISSED_RANGE)
|
new_config['GUI']['coming_eps_missed_range'] = int(COMING_EPS_MISSED_RANGE)
|
||||||
new_config['GUI']['date_preset'] = DATE_PRESET
|
new_config['GUI']['date_preset'] = DATE_PRESET
|
||||||
new_config['GUI']['time_preset'] = TIME_PRESET_W_SECONDS
|
new_config['GUI']['time_preset'] = TIME_PRESET_W_SECONDS
|
||||||
|
new_config['GUI']['timezone_display'] = TIMEZONE_DISPLAY
|
||||||
|
|
||||||
new_config['Subtitles'] = {}
|
new_config['Subtitles'] = {}
|
||||||
new_config['Subtitles']['use_subtitles'] = int(USE_SUBTITLES)
|
new_config['Subtitles']['use_subtitles'] = int(USE_SUBTITLES)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sickbeard
|
||||||
from lib.dateutil import tz
|
from lib.dateutil import tz
|
||||||
import lib.dateutil.zoneinfo
|
import lib.dateutil.zoneinfo
|
||||||
from sickbeard import db
|
from sickbeard import db
|
||||||
@ -225,7 +226,7 @@ def get_network_timezone(network, network_dict):
|
|||||||
|
|
||||||
|
|
||||||
# parse date and time string into local time
|
# parse date and time string into local time
|
||||||
def parse_date_time(d, t, network, local=False):
|
def parse_date_time(d, t, network):
|
||||||
if network_dict is None:
|
if network_dict is None:
|
||||||
load_network_dict()
|
load_network_dict()
|
||||||
mo = time_regex.search(t)
|
mo = time_regex.search(t)
|
||||||
@ -257,16 +258,16 @@ def parse_date_time(d, t, network, local=False):
|
|||||||
if hr < 0 or hr > 23 or m < 0 or m > 59:
|
if hr < 0 or hr > 23 or m < 0 or m > 59:
|
||||||
hr = 0
|
hr = 0
|
||||||
m = 0
|
m = 0
|
||||||
te = datetime.datetime.fromordinal(helpers.tryInt(d))
|
|
||||||
foreign_timezone = get_network_timezone(network, network_dict)
|
|
||||||
foreign_naive = datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=foreign_timezone)
|
|
||||||
try:
|
|
||||||
if local:
|
|
||||||
return foreign_naive.replace(tzinfo=sb_timezone).astimezone(sb_timezone)
|
|
||||||
return foreign_naive.astimezone(sb_timezone)
|
|
||||||
except (ValueError):
|
|
||||||
return foreign_naive
|
|
||||||
|
|
||||||
|
te = datetime.datetime.fromordinal(helpers.tryInt(d))
|
||||||
|
try:
|
||||||
|
if sickbeard.TIMEZONE_DISPLAY == 'local':
|
||||||
|
return datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=sb_timezone)
|
||||||
|
else:
|
||||||
|
foreign_timezone = get_network_timezone(network, network_dict)
|
||||||
|
return datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=foreign_timezone)
|
||||||
|
except:
|
||||||
|
return datetime.datetime(te.year, te.month, te.day, hr, m)
|
||||||
|
|
||||||
def test_timeformat(t):
|
def test_timeformat(t):
|
||||||
mo = time_regex.search(t)
|
mo = time_regex.search(t)
|
||||||
|
@ -1010,7 +1010,8 @@ class ConfigGeneral:
|
|||||||
update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None, use_api=None, api_key=None,
|
update_shows_on_start=None, update_frequency=None, launch_browser=None, web_username=None, use_api=None, api_key=None,
|
||||||
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
||||||
handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None,
|
handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None,
|
||||||
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None, indexer_default=None,):
|
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None,
|
||||||
|
indexer_default=None, timezone_display=None):
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
@ -1047,6 +1048,8 @@ class ConfigGeneral:
|
|||||||
sickbeard.TIME_PRESET_W_SECONDS = time_preset
|
sickbeard.TIME_PRESET_W_SECONDS = time_preset
|
||||||
sickbeard.TIME_PRESET = sickbeard.TIME_PRESET_W_SECONDS.replace(u":%S", u"")
|
sickbeard.TIME_PRESET = sickbeard.TIME_PRESET_W_SECONDS.replace(u":%S", u"")
|
||||||
|
|
||||||
|
sickbeard.TIMEZONE_DISPLAY = timezone_display
|
||||||
|
|
||||||
if not config.change_LOG_DIR(log_dir, web_log):
|
if not config.change_LOG_DIR(log_dir, web_log):
|
||||||
results += ["Unable to create directory " + os.path.normpath(log_dir) + ", log directory not changed."]
|
results += ["Unable to create directory " + os.path.normpath(log_dir) + ", log directory not changed."]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user