Riprendi la visione di film e serie tv:

- per i video in videoteca
 - con modalità di Riproduzione Diretta o Built-In o in finestra
 - indipendente dal server

 Impostazioni percentuale  segna come già visto spostata in Impostazioni
This commit is contained in:
Alhaziel01
2020-06-13 19:00:43 +02:00
parent ad9d0ae022
commit ac7aedd703
5 changed files with 44 additions and 35 deletions
+35 -20
View File
@@ -5,7 +5,7 @@
from future import standard_library from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
#from builtins import str #from builtins import str
import sys, os, threading, time, re, math, xbmc import sys, os, threading, time, re, math, xbmc, xbmcgui
PY3 = False PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
@@ -34,36 +34,43 @@ def mark_auto_as_watched(item):
title = str(item.contentSeason) + 'x' + str(item.contentEpisodeNumber).zfill(2) title = str(item.contentSeason) + 'x' + str(item.contentEpisodeNumber).zfill(2)
else: else:
season, episode = scrapertools.find_single_match(item.title, r'(\d+)x(\d+)') season, episode = scrapertools.find_single_match(item.title, r'(\d+)x(\d+)')
item.contentSeason = int(season)
item.contentEpisodeNumber = int(episode)
title = season + 'x' + episode.zfill(2) title = season + 'x' + episode.zfill(2)
if not item.strm_path: item.strm_path = filetools.join(path, title + '.strm') if not item.strm_path: item.strm_path = filetools.join(path, title + '.strm')
condicion = config.get_setting("watched_setting", "videolibrary")
time_limit = time.time() + 30 time_limit = time.time() + 30
while not platformtools.is_playing() and time.time() < time_limit: while not platformtools.is_playing() and time.time() < time_limit:
time.sleep(1) time.sleep(1)
sync_with_trakt = False # check if the video hasn't played until the end
# load nfo file
from core import videolibrarytools
if item.contentType == 'movie': nfo_path = item.nfo
elif xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows"))) in item.strm_path:
nfo_path = item.strm_path.replace('strm','nfo')
else:
nfo_path = xbmc.translatePath(filetools.join(config.get_setting("videolibrarypath"), config.get_setting("folder_tvshows"),item.strm_path.replace('strm','nfo')))
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
#show Window
if item_nfo.played_time and (config.get_setting("player_mode") not in [1, 3] or item.play_from == 'window'):
while not xbmcgui.getCurrentWindowId() == 12005:
time.sleep(1)
m, s = divmod(item_nfo.played_time, 60)
h, m = divmod(m, 60)
if platformtools.dialog_yesno(item.title, '[B]' + config.get_localized_string(30045) +' %02d:%02d:%02d[/B]' % (h, m, s)):
xbmc.Player().seekTime(item_nfo.played_time)
sync_with_trakt = False
while platformtools.is_playing(): while platformtools.is_playing():
tiempo_actual = xbmc.Player().getTime() percentage = config.get_setting("watched_setting") / 100
actual_time = xbmc.Player().getTime()
totaltime = xbmc.Player().getTotalTime() totaltime = xbmc.Player().getTotalTime()
mark_time = 0 mark_time = totaltime * percentage
if condicion == 0: # '5 minutos'
mark_time = 300
elif condicion == 1: # '30%'
mark_time = totaltime * 0.3
elif condicion == 2: # '50%'
mark_time = totaltime * 0.5
elif condicion == 3: # '80%'
mark_time = totaltime * 0.8
elif condicion == 4: # '0 seg'
mark_time = -1
# logger.debug(str(tiempo_actual)) if actual_time > mark_time:
# logger.debug(str(mark_time))
if tiempo_actual > mark_time:
logger.debug("Marked as Watched") logger.debug("Marked as Watched")
item.playcount = 1 item.playcount = 1
sync_with_trakt = True sync_with_trakt = True
@@ -71,7 +78,15 @@ def mark_auto_as_watched(item):
videolibrary.mark_content_as_watched2(item) videolibrary.mark_content_as_watched2(item)
break break
time.sleep(5) time.sleep(1)
# Set played time
if not sync_with_trakt and actual_time > 120:
played_time = actual_time
else:
played_time = 0
item_nfo.played_time = int(played_time)
filetools.write(nfo_path, head_nfo + item_nfo.tojson())
# Silent sync with Trakt # Silent sync with Trakt
if sync_with_trakt and config.get_setting("trakt_sync"): if sync_with_trakt and config.get_setting("trakt_sync"):
@@ -191,6 +191,10 @@ msgctxt "#30044"
msgid "Play mode" msgid "Play mode"
msgstr "" msgstr ""
msgctxt "#30045"
msgid "Resume from:"
msgstr ""
msgctxt "#30050" msgctxt "#30050"
msgid "Server connection error" msgid "Server connection error"
msgstr "" msgstr ""
@@ -191,6 +191,10 @@ msgctxt "#30044"
msgid "Play mode" msgid "Play mode"
msgstr "Modalità di riproduzione" msgstr "Modalità di riproduzione"
msgctxt "#30045"
msgid "Resume from:"
msgstr "Riprendi da:"
msgctxt "#30050" msgctxt "#30050"
msgid "Server connection error" msgid "Server connection error"
msgstr "Errore connessione server" msgstr "Errore connessione server"
+1
View File
@@ -38,6 +38,7 @@
<setting id="next_ep" type="select" label="70746" lvalues="70752|70747|70748" default="0"/> <setting id="next_ep" type="select" label="70746" lvalues="70752|70747|70748" default="0"/>
<setting id="next_ep_type" type="select" label="70754" lvalues="70755|70756|70757" default="0" visible="eq(-1,2)" subsetting="true"/> <setting id="next_ep_type" type="select" label="70754" lvalues="70755|70756|70757" default="0" visible="eq(-1,2)" subsetting="true"/>
<setting id="next_ep_seconds" type="slider" option="int" range="20,10,120" label="70749" default="40" visible="!eq(-2,0)" subsetting="true"/> <setting id="next_ep_seconds" type="slider" option="int" range="20,10,120" label="70749" default="40" visible="!eq(-2,0)" subsetting="true"/>
<setting id="watched_setting" type="slider" option="int" range="20,10,100" label="60634" default="80"/>
<setting id="trakt_sync" type="bool" label="70109" default="false"/> <setting id="trakt_sync" type="bool" label="70109" default="false"/>
<setting label="30030" type="lsep"/> <setting label="30030" type="lsep"/>
<setting id="vidolibrary_preferences" type="action" label="60542" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiY2hhbm5lbF9jb25maWciLA0KICAgICJjaGFubmVsIjogInZpZGVvbGlicmFyeSINCn0==)"/> <setting id="vidolibrary_preferences" type="action" label="60542" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAiY2hhbm5lbF9jb25maWciLA0KICAgICJjaGFubmVsIjogInZpZGVvbGlicmFyeSINCn0==)"/>
-15
View File
@@ -209,21 +209,6 @@
"enabled": true, "enabled": true,
"visible": true "visible": true
}, },
{
"id": "watched_setting",
"type": "list",
"label": "@60635",
"default": 3,
"visible": true,
"enabled": "eq(-1,true)",
"lvalues": [
"5 min",
"30%",
"50%",
"80%",
"@60636"
]
},
{ {
"id": "sync_trakt", "id": "sync_trakt",
"type": "label", "type": "label",