Git Product home page Git Product logo

player-tracker's Introduction

player-tracker

A tool that automatically updates various TV trackers while you're watching stuff.

Installation

Clone the repo, install dependencies.

pip install -r requirements.txt

Usage

python player-tracker.py

To enable services, uncomment lines in services/__init__.py.

How it works

  • Builds a list of files opened in your media player
  • Filenames are parsed using guessit
  • Titles are searched on various services
  • Matching entries are updated

player-tracker's People

Contributors

po5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nader-web

player-tracker's Issues

Error when logging in with newly created Trakt API App: name 'time' is not defined

Please visit the following link in your browser https://trakt.tv/oauth/applications/new
- Give your app a name
- Set the redirect URI to 'urn:ietf:wg:oauth:2.0:oob'
- Enable the '/scrobble' permission
- Press 'Save App'
Enter your Trakt.tv client id: ***
Enter your Trakt.tv client secret: ***
Traceback (most recent call last):
  File "player-tracker.py", line 11, in <module>
    import services
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\__init__.py", line 4, in <module>
    from . import trakt
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\trakt.py", line 113, in <module>
    tokens = token(client_id, client_secret)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\trakt.py", line 70, in token
    start = time.time()
NameError: name 'time' is not defined
PS E:\Downloads\player-tracker-master\player-tracker-master>

Feature Request: Hold the update untill the video player has been closed or start playing the next video file

When playing a video file, the tracker updates all the services when the file plays. This is around 1 to 30 seconds after starting the video.

While this could work for some, i would like to have the updates being pushed out to the services when the video player closes or when the player switches to the next video file like you can set up in Taiga.

This would mean that the update times are on when you've completed an episode or movie instead of beginning it.

If this can be realised, maybe it's better to make this a toggle so the user can decide when the updates are being pushed out.

Issues when detecting movies

OS: Windows 10 1607 LTSB
player-tracker version: 6492ba8

After testing some movies to update to the services, i've found that some of the movies does not want to be detected as movies. Some also give a Traceback errors at the AniList MyAnimeList updater. One of them doesn't want to even update to Trakt.

Moving the movies under the folder Movies did not solve the issue.

For example:
Puella Magi Madoka Magica the Movie Part I: Beginnings
Filename: Puella Magi Madoka Magica the Movie Part I Beginnings (2012) [1920x1080_x264][***].mkv

Searching on anilist...
Already in list Puella Magi Madoka Magica - Season 1 Episode 1
Searching on myanimelist...
Already in list Mahou Shoujo Madoka★Magica - Season 1 Episode 1
Searching on trakt...
Our best match is Puella Magi Madoka Magica - Season 1 Episode 1

2nd try:

Searching on anilist...
Already in list Puella Magi Madoka Magica
Searching on myanimelist...
Our best match is Mahou Shoujo Madoka★Magica Movie 1: Hajimari no Monogatari
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Searching on trakt...
Already in list Puella Magi Madoka Magica

Kara no Kyoukai Movie 1
Filename: [***] Kara no Kyoukai - 1 - Overlooking View [BDRip 1080p x264 FLAC],mkv

Searching on anilist...
Our best match is Kara no Kyoukai: Mujun Rasen
Searching on myanimelist...
Our best match is Kara no Kyoukai: Mirai Fukuin
Traceback (most recent call last):
  File ".\player-tracker.py", line 156, in <module>
    search_and_match(**info)
  File ".\player-tracker.py", line 129, in search_and_match
    if update(module, match, format) is False:
  File ".\player-tracker.py", line 136, in update
    module.update(match["id"], match["season"], match["episode"], match["completed"], format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 62, in update
    api = session.post(url, data=post).json()
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2nd try (Took quite a long time to respond at the AniList updater)

Searching on anilist...
Traceback (most recent call last):
  File ".\player-tracker.py", line 156, in <module>
    search_and_match(**info)
  File ".\player-tracker.py", line 87, in search_and_match
    search = module.search(title)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\anilist.py", line 96, in search
    """}).json()
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Try 4 (3 is the same as 1):

Searching on anilist...
Already in list Kara no Kyoukai: Mujun Rasen
Searching on myanimelist...
Our best match is Kara no Kyoukai: Mirai Fukuin
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Traceback (most recent call last):
  File ".\player-tracker.py", line 156, in <module>
    search_and_match(**info)
  File ".\player-tracker.py", line 129, in search_and_match
    if update(module, match, format) is False:
  File ".\player-tracker.py", line 136, in update
    module.update(match["id"], match["season"], match["episode"], match["completed"], format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 50, in update
    return update(id, season, progress, completed, format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 50, in update
    return update(id, season, progress, completed, format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 62, in update
    api = session.post(url, data=post).json()
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Jin-Roh
FileName: jin-roh_-_the_wolf_brigade[1828x988.h10p.flac.ac3][***]

Searching on anilist...
Our best match is Jin-Roh
Searching on myanimelist...
Our best match is Jin-Rou
Traceback (most recent call last):
  File ".\player-tracker.py", line 156, in <module>
    search_and_match(**info)
  File ".\player-tracker.py", line 129, in search_and_match
    if update(module, match, format) is False:
  File ".\player-tracker.py", line 136, in update
    module.update(match["id"], match["season"], match["episode"], match["completed"], format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 62, in update
    api = session.post(url, data=post).json()
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Melvin\scoop\apps\python36\current\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2nd try (moved the video file to a folder called movies)

Searching on anilist...
Our best match is Jin-Roh
Searching on myanimelist...
Our best match is Jin-Rou
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Searching on trakt...
Our best match is Jin-Roh: The Wolf Brigade

The Wings of Honneamise (the Trakt updater didn't updated it to the service)
Filename: The_Wings_of_Honneamise_[BD.1080p_DTS_AC3]_[***]

Searching on anilist...
Already in list Magi: The Kingdom of Magic - Season 1 Episode 1
Searching on myanimelist...
Our best match is Seupideuwang Beongae - Season 1 Episode 1
Searching on trakt...
Our best match is Royal Space Force - The Wings Of Honneamise - Season 1 Episode 1

Try 2 and 3 is the same as the first try. On the second try i get the same Traceback error as at Jin-Roh and Kara no Kyoukai. The movie did not once again update to Trakt on the third time.

So far these movies can be updated to all the three services with no detection issues (the Traceback error might be a problem sometimes):
Jin-Roh
Mobile Suit Gundam I

This could be guessit thing when detecting movies as moving these video files to the Movies folder fixed this issue for me on other programs. That fix does not apply here since it only detects the filename i think. But the Traceback error can be looked at.

Anilist updates episodes that is out of range (2223 out of 12), while MAL does not

OS: Windows 10 1607 LTSB
player-tracker version: 1fa74e6

I've got the SCP-2223 release of Kaiba and the AniList and MyAnimeList parses the episode counts differently.

If i play episode 1, AniList parses the SCP-2223 section as the episode count and updates that to AniList.
The MyAnimeList updater however parses the actual episode count, episode 1. On the first try it updated to MyAnimeList successfully while the second try outputs a Traceback error.

The second episode also updated successfully on the first try while AniList stays at episode 2223.

PS E:\Downloads\player-tracker-master\player-tracker-master> python.exe .\player-tracker.py
Updating AniList...
Updating MyAnimeList...
Waiting 30s...
Searching on anilist...
Our best match is カイバ - Season 1 Episode 2223
Searching on myanimelist...
Our best match is Kaiba - Season 1 Episode 1
Traceback (most recent call last):
  File ".\player-tracker.py", line 133, in <module>
    search_and_match(**info)
  File ".\player-tracker.py", line 121, in search_and_match
    update(module, match, format)
  File ".\player-tracker.py", line 127, in update
    module.update(match["id"], match["season"], match["episode"], match["completed"], format)
  File "E:\Downloads\player-tracker-master\player-tracker-master\services\myanimelist.py", line 51, in update
    episodes = int(document.css("#anime_num_episodes")[0].attributes["value"])
IndexError: list index out of range
PS E:\Downloads\player-tracker-master\player-tracker-master>

Trakt updater doesn't update despite a succesfull update

OS: Windows 10 1607 LTSB
player-tracker version: 977a486

When player-tracker updates the Trakt service, the update doesn't show up on the website. Meaning that the update has been unsuccessful to update despite having no errors in the output.

I've deleted my Trakt json file and re-logged into the service, but no luck either. This problem didn't occured to me with version e3d62a0.

Other services like MyAnimeList and AniList works fine.

In the picture below you'll see my latest history on Trakt. You'll see that the shows / movies that are in the output (except Giant Robo, but that's because it has "The Animation" in the name and the Trakt entry hasn't).

2019-07-23_11-40-21

This is the output i have so far:

PS E:\Downloads\player-tracker-master\player-tracker-master> py.exe .\player-tracker.py
Updating AniList...
Updating MyAnimeList...
Please visit the following link in your browser https://trakt.tv/oauth/applications/new
- Give your app a name
- Set the redirect URI to 'urn:ietf:wg:oauth:2.0:oob'
- Enable the '/scrobble' permission
- Press 'Save App'
Enter your Trakt.tv client id: ***
Enter your Trakt.tv client secret: ***
Please visit the following link in your browser https://trakt.tv/activate
and enter this code: ***
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Searching on anilist...
Our best match is Giant Robo the Animation: The Day the Earth Stood Still - Season 1 Episode 1
Searching on myanimelist...
Our best match is Aria The Animation - Season 1 Episode 1
Searching on trakt...
No matches found Giant Robo the Animation The Day the Earth Stood Still 1
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Searching on anilist...
Our best match is Houseki no Kuni - Season 1 Episode 1
Searching on myanimelist...
Our best match is Houseki no Kuni - Season 1 Episode 1
Searching on trakt...
Our best match is Houseki no Kuni - Season 1 Episode 1
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Searching on anilist...
Our best match is Jin-Roh
Searching on myanimelist...
Our best match is Jin-Rou
Rate limited on MyAnimeList, waiting 20s...
Rate limited on MyAnimeList, waiting 20s...
Searching on trakt...
Our best match is Jin-Roh: The Wolf Brigade
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...
Waiting 30s...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.