Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service.watchedlist] 1.3.6 #2538

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions service.watchedlist/LICENSE.txt

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions service.watchedlist/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.watchedlist"
name="WatchedList"
version="1.3.6"
provider-name="schapplm">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.buggalo" version="1.2.0" />
<import addon="script.module.myconnpy" version="8.0.33" />
<!--<import addon="script.module.pydevd" version="3.4.1"/> --> <!-- Required for remote debugging in Linux -->
<import addon="script.module.dropbox" version="10.3.1+matrix.1"/> <!-- For Dropbox synchronisation -->
<import addon="script.module.dropbox_auth" version="10.3.1" optional="true"/> <!-- For Dropbox authentification -->
</requires>
<extension point="xbmc.python.script" library="manual.py"> <!--Python code for manual start in the addons menu-->
<provides>executable</provides> <!-- Addon is shown under Programs -->
</extension>
<extension point="xbmc.service" library="default.py" /> <!-- Python code for autostart -->
<extension point="xbmc.python.module" library="lib" /> <!-- entry to access the WatchedList from other addons -->
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Save watched state of movies and TV-series episodes independent from filenames</summary>
<summary lang="de_DE">Gesehen-Status von Filmen und Serien-Episoden unabhängig von Dateinamen speichern</summary>
<description lang="en_GB">
Export: Searches the Kodi-Database for watched files. Determine imdb-id and thetvdb-id to identify movies and TV-episodes. Then save the list to a new independent table.
Import: Set the watched state for each video file in Kodi.
Automatic background process without user interaction.</description>
<description lang="de_DE">
Export: Durchsucht die Kodi-Datenbank nach gesehenen Filmen und ordnet den Dateien die eindeutigen Kennnummern von imdb und TheTVDB zu. Gesehene Filme und Episoden werden jeweils in einer eigenen Datenbank gespeichert.
Import: Der Gesehen-Status von Medien in Kodi wird aus der Gesehenen-Tabelle geholt.
Die Synchronisierung geschieht automatisch im Hintergrund ohne Benutzereingriff.</description>
<disclaimer lang="en_GB">This script does not regard the file format. A Movie watched in DVD quality will also set the 1080p version as watched.</disclaimer>
<disclaimer lang="de_DE">Dieses Script ignoriert das Dateiformat. Ein gesehener Film in DVD-Qualität wird auch in der BlueRay-Version als gesehen gekennzeichnet.</disclaimer>
<platform>all</platform>
<license>GPL-2.0-or-later</license>
<forum>https://forum.kodi.tv/showthread.php?tid=164652</forum>
<website>https://kodi.wiki/view/Add-on:WatchedList</website>
<source>https://github.com/SchapplM/xbmc-addon-service-watchedlist</source>
<news>1.3.6 - Dependency update for Kodi Nexus</news>
<assets>
<icon>icon.png</icon>
<fanart>fanart.jpg</fanart>
</assets>
</extension>
</addon>
109 changes: 109 additions & 0 deletions service.watchedlist/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
version 1.3.5 (28.11.2021)
* Fix for inconsistent imdb/tvdb numbers and new database format

version 1.3.4 (23.10.2021)
* Fix for The Movie Database scraper

version 1.3.3 (01.08.2021)
* Fix for new python interface in Kodi v20

version 1.3 (24.04.2020)
* Updated to work with Python 3

version 1.2.7 (03.05.2019)
* Minor fixes (mysql access protection, remove credentials from log file)

version 1.2.6 (16.02.2019)
* Fixed waiting time for periodic update during playback

version 1.2.5 (04.01.2018)
* Fix SMB access in Windows, minor code improvements

version 1.2.4 (01.01.2018)
* Fix in background user watching

version 1.2.3 (28.12.2017)
* Minor fixes (unicode support, less blocking on shutdown, backup file rotation on network shares, error handling and logging)

version 1.2.2 (23.12.2017)
* Minor fixes, fixed buggalo emails

version 1.2.1 (26.11.2017)
* Fixed Dropbox API: Change from v1 to v2

version 1.2 (21.05.2017)
* Added API and python module to use this addon in other addons
* minor fixes

version 1.1.4 (28.04.2017)
* Fixed error in English language file

version 1.1.3 (16.04.2017)
* Added verbosity option for graphical user notifications
* Added limitation of number of backup files

version 1.1.2 (12.06.2016)
* Added fix to avoid infinite waiting if startup delay time is 0

version 1.1.1 (29.05.2016)
* Added fix for non-working python dropbox import

version 1.1.0 (02.04.2016)
* Added dropbox synchronization for the database

version 1.0.5 (24.12.2015)
* Enabled IPv6 adresses for hostnames

version 1.0.4 (16.05.2015)
* Fixed mysql timestamp bug

version 1.0.3 (11.01.2015)
* Fixed wrong implementation of startup delay
* Fixed missing startup execution if autostart mode is set to periodic

version 1.0.2 (10.01.2015)
* Fixed support for Database file got lost in version 1.0.0

version 1.0.1 (13.12.2014)
* Fixed unwanted waiting time in autostart

version 1.0.0 (01.09.2014)
* Added mySQL Database support for the WatchedList Database

version 0.9.8 (31.08.2014)
* Fix for Unicode Path problems
* Fix for SQLite Error handling

version 0.9.7 (14.06.2014)
* Added custom sleep function to handle requested shutdown in Gotham

version 0.9.6 (23.09.2013)
* Fixed tvshow id with imdb-scraper

version 0.9.5 (18.09.2013)
* Fixed bug in watching user actions

version 0.9.4 (09.09.2013)
* Fixed bug in watching user actions

version 0.9.3 (04.09.2013)
* Fixed minor bugs

version 0.9.2 (01.08.2013)
* Fixed minor bugs

version 0.9.1 (24.06.2013)
* Fixed: Network share problems in Linux

version 0.9.0 (09.06.2013)
* Added: Check watched-states permanently and enable to set media as unwatched

version 0.8.1 (22.05.2013)
* Fixed: Duplicate movies and tv episodes get marked as watched

version 0.8.0 (16.05.2013)
* Fixed: lastplayed-information is now also stored in the database (although it is sometimes missing in XBMC)
* Added: Exceptions are catched with buggalo and bug reports are sent

version 0.7.0 (11.05.2013)
* Initial release
31 changes: 31 additions & 0 deletions service.watchedlist/default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
This file is entry point for automatic start via Kodi
"""

import sys

import xbmc

import lib.watchedlist.utils as utils
from lib.watchedlist.watchedlist import WatchedList

__remotedebug__ = False
# Append pydev remote debugger
if __remotedebug__:
utils.log("Initialize remote debugging.")
# Make pydev debugger works for auto reload.
try:
import pydevd
pydevd.settrace('localhost', port=60678, stdoutToServer=True, stderrToServer=True)
except ImportError:
sys.stderr.write("Error: " +
"You must add org.python.pydev.debug.pysrc to your PYTHONPATH.")
utils.showNotification('WatchedList Error', 'remote debug could not be imported.', xbmc.LOGERROR)
sys.exit(1)
except BaseException:
utils.showNotification('WatchedList Error', 'remote debug in pydev is activated, but remote server not responding.', xbmc.LOGERROR)
sys.exit(1)

# Run the program
utils.log("WatchedList Database Service starting...")
WatchedList().runProgram()
Binary file added service.watchedlist/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added service.watchedlist/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 110 additions & 0 deletions service.watchedlist/lib/watchedlist/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
"""
This file contains API functions for the usage of WatchedList with other Kodi addons
"""

import time

import xbmc

from lib.watchedlist.watchedlist import WatchedList
import lib.watchedlist.utils as utils


def change_watched_movie(imdb_id, playCount=1, name=''):
"""
Change the watched state of one movie in the WL database

Args:
imdb_id: ID of the movie in the imdb. Format: Integer, numbers after 'tt0012345'
playCount: Unsigned Integer
name: Title of the movie (optional)

Returns:
Error Code (0=No error)
"""

if not name:
name = 'tt%d' % imdb_id
if playCount == 0:
lastPlayed = 0
else:
lastPlayed = int(time.time())
row_xbmc = [imdb_id, 0, 0, lastPlayed, playCount, name, 0] # 0imdbnumber, 1empty, 2empty, 3lastPlayed, 4playCount, 5title, 6empty, 7movieid
saveanyway = True
commit = True
lastChange = lastPlayed
with WatchedList(True) as WL:
if WL.get_watched_wl(1): # Read the WL database
utils.showNotification(utils.getString(32102), utils.getString(32602), xbmc.LOGERROR)
return 1
WL.wl_update_media('movie', row_xbmc, saveanyway, commit, lastChange)
return 0


def change_watched_episode(tvdb_id, season, episode, playCount=1, name=''):
"""
Change the watched state of one episode in the WL database

Args:
tvdb_id: ID of the tv show in tvdb. Format: Integer
season: Number of the season (Integer) within the show
episode: Number of the episode within the season (Integer)
playCount: Unsigned Integer
name: Name of the Episode (optional)

Returns:
Error Code (0=No error)
"""

if not name:
name = 'tvdb%d S%02dE%02d' % (tvdb_id, season, episode)
if playCount == 0:
lastPlayed = 0
else:
lastPlayed = int(time.time())
row_xbmc = [tvdb_id, season, episode, lastPlayed, playCount, name, 0] # 0imdbnumber, 1empty, 2empty, 3lastPlayed, 4playCount, 5title, 6empty, 7movieid
saveanyway = True
commit = True
lastChange = lastPlayed
with WatchedList(True) as WL:
if WL.get_watched_wl(1): # Read the WL database
utils.showNotification(utils.getString(32102), utils.getString(32602), xbmc.LOGERROR)
return 1
WL.wl_update_media('episode', row_xbmc, saveanyway, commit, lastChange)
return 0


def change_watched_episodes(tvdb_id, seasons, episodes, playCount, names):
"""
Change the watched state of multiple episodes of one tv show in the WL database

Args:
tvdb_id: ID of the tv show in tvdb. Format: Integer
seasons: Number of the seasons for the affected episodes (list of Integers)
episodes: Number of the episodes within the seasons (list of Integers, same length as seasons list).
playCount: Unsigned Integer
names: Names of the Episodes (list of strings, same length as lists above)

Returns:
Error Code (0=No error)
"""

if playCount == 0:
lastPlayed = 0
else:
lastPlayed = int(time.time())
with WatchedList(True) as WL:
if WL.get_watched_wl(1): # Read the WL database
utils.showNotification(utils.getString(32102), utils.getString(32602), xbmc.LOGERROR)
return 1
for i in range(len(seasons)):
row_xbmc_i = [tvdb_id, seasons[i], episodes[i], lastPlayed, playCount, names[i], 0] # 0imdbnumber, 1empty, 2empty, 3lastPlayed, 4playCount, 5title, 6empty, 7movieid
saveanyway = True
if i == len(seasons) - 1:
commit = True # Only commit the last row to reduce file access to the database
else:
commit = False
lastChange = lastPlayed

WL.wl_update_media('episode', row_xbmc_i, saveanyway, commit, lastChange)
return 0
Loading
Loading