Giter Site home page Giter Site logo

z411 / trackma Goto Github PK

View Code? Open in Web Editor NEW
757.0 31.0 83.0 5.01 MB

Open multi-site list manager for Unix-like systems. (ex-wMAL)

Home Page: https://z411.github.io/trackma

License: GNU General Public License v3.0

Python 100.00%
python anime manga curses gtk3 qt5 inotify mpris

trackma's Introduction

Trackma

Trackma aims to be a lightweight and simple but feature-rich program for Unix based systems for fetching, updating and using data from personal lists hosted in several media tracking websites.

Features

  • Manage local list and synchronize when necessary, useful when offline
  • Manage multiple accounts on different media tracking sites
  • Support for several media types (as supported by the site)
  • Multiple user interfaces (Qt, GTK, curses, command-line)
  • Detection of running media player, updates list if necessary
  • Ability to launch media player for a requested media in the list and update list if necessary
  • Highly scalable, easy to code new interfaces and support for other sites
  • Secure, uses HTTPS wherever possible.

Currently supported websites

Screenshots

Qt interface

Qt

GTK interface

GTK

Curses interface

Curses

CLI

CLI

Dependencies

The only required dependency to run Trackma is:

  • Python 3.7+
  • python3-pip (to install through pip) or python3-poetry (to install through poetry)

But only basic features will work (only CLI interface and no tracker). Everything else is optional.

The following user interfaces are available and their requirements are as follows:

UI Dependencies
Qt PyQt5 (python-pyqt5)
GTK 3 PyGI (python3-gi and python3-cairo)
curses Urwid (python3-urwid)
CLI None

The following media recognition trackers are available and their requirements are as follows:

Tracker Description Dependencies
inotify Instant, but only supported in Linux. Uses it whenever possible. inotify or pyinotify
Polling Slow, but supported in every POSIX platform. Fallback. lsof
Plex Connects to Plex server. Enabled manually. None
Kodi Connects to Kodi server. Enabled manually. None
Jellyfin Connects to Jellyfin server. Enabled manually. None
MPRIS Connects to running MPRIS capable media players. dbus-python
Win32 Recognition for Windows platforms. None

Additional optional dependencies:

  • PIL (python3-pil) - for showing preview images in the Qt/GTK interfaces.

Installation

Trackma has user-provided packages for several distributions.

A user from the community also is providing a Docker image:

Manual installation

Make sure you've installed the proper dependencies (listed above) according to the user interface you plan to use, and then run the following command:

$ pip3 install Trackma

You can also install the git (probably unstable, but newer) version like this:

$ pip3 install -U git+https://github.com/z411/trackma.git

Or download the source code and install:

$ git clone --recursive https://github.com/z411/trackma.git
$ cd trackma
$ poetry build
$ pip3 install dist/trackma-0.8.5-py3-none-any.whl

Extras (User Interfaces)

All user interfaces except for the default CLI mode require additional dependencies to function. You may specify these as "extras" to be installed by the Python package manager.

The following extras are available:

Extra Description
gtk The GTK interface.
qt The Qt interface.
curses The curses-based TUI.
ui All user interfaces.
trackers All tracker libraries.
discord_rpc Set your watching activity in Discord.
twitter Announce your watching activity on Twitter.

If you want to install any of the extras be sure to specify them during installation:

pip

# With pip
$ pip3 install Trackma[gtk,trackers,curses]
$ pip3 install Trackma[ui,twitter,discord_rpc]

Note that pip does not have a way to install all available extras, so you'll have to provide them all manually if desired.

Then you can run the program with the interface you like.

$ trackma
$ trackma-curses
$ trackma-gtk
$ trackma-qt

poetry

When using poetry on the cloned repository (see above), you can install your desired extras as follows:

$ poetry install -E gtk -E trackers -E curses
$ poetry install -E ui -E twitter -E discord_rpc
$ poetry install --all-extras

Then you can run the interface you like in your virtual environment managed by poetry:

$ poetry run trackma
$ poetry run trackma-curses
$ poetry run trackma-gtk
$ poetry run trackma-qt

Configuration

A configuration file will be created in ~/.config/trackma/config.json, make sure to fill in the directory where you store your video files and other settings. Details about what each option does can be done here:

https://github.com/z411/trackma/wiki/Configuration-File

Alternatively, the GTK and Qt interfaces provide a visual Settings panel.

Development

The code is hosted as a git repository on GitHub.

Clone the repo and create the virtual environment using poetry:

$ git clone --recursive https://github.com/z411/trackma.git
$ cd trackma
$ poetry install --all-extras
$ poetry shell

Use the above commands from the poetry section for how to run your desired interface.

If you encounter any problems or have anything to suggest, please don't hesitate to submit an issue in the GitHub issue tracker.

License

Trackma is licensed under the GPLv3 license, please see LICENSE for details.

Authors

Trackma was originally written by z411 [email protected]. For other contributors see AUTHORS file. GTK icon designed by shuuichi.

trackma's People

Stargazers

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

Watchers

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

trackma's Issues

libmal search error (sometimes)

The search api sometimes returns non-gzipped file. It seems to not like certain searches. For instance " Arpeggio of Blue Steel - Ars Nova" doesn't work, it's too long, but I'm not sure it's the only criteria ...

wmal-cli missing scores in list

wmal-cli lacks any showing of my scores. I can update my score of a given show, but I can't tell what I'm changing it from.

.wmal not created on first startup

On first run, wmal-gtk throws the error

IOError: [Errno 2] No such file or directory: '/home/<user>/.wmal/wmal-gtk.json'

After creating the .wmal folder, the error went away and wmal-gtk launched normally.

Sort by score

There is a way to improve the sort of the score in the GTK version ?
When I want to sort the list, it's end like that :
Anime 1 | 2/2 | 1 | 100%
Anime 2 | 12/12 | 10 | 100%
Anime 3 | 6/6 | 5 | 100%
Anime 4 | 12/12 | 7 | 100%
Anime 5 | 24/24 | 8 | 100%
Anime 6 | 1/1 | 9 | 100%

The animes which are rated with a 10 are between the ones which are rated 1 and 2. Maybe because the Score column cell's type is a string and not a integer.

With my few knowledge of Python, I try to change the ListStore function with a int instead of str (here), but nothing change when I use it.

And sorry for my english, it's not my mother tongue.

Crash/stuck at "libmal: Logging in..." when opening wmal/wmal-gtk

Stays stuck on "libmal: logging in" and finally shows the following trace:

Initializing engine...
Engine: Version v0.2
Engine: Reading config files...
Data: Version v0.2
libmal: Version v0.2
Data: Using libmal (anime)
libmal: Logging in...
Traceback (most recent call last):
  File "/usr/bin/wmal", line 9, in <module>
    wmal.ui.cli.main()
  File "/usr/lib/python2.7/site-packages/wmal/ui/cli.py", line 518, in main
    main_cmd.start()
  File "/usr/lib/python2.7/site-packages/wmal/ui/cli.py", line 74, in start
    self.engine.start()
  File "/usr/lib/python2.7/site-packages/wmal/engine.py", line 123, in start
    (self.api_info, self.mediainfo) = self.data_handler.start()
  File "/usr/lib/python2.7/site-packages/wmal/data.py", line 132, in start
    self.download_data()
  File "/usr/lib/python2.7/site-packages/wmal/data.py", line 431, in download_data
    self.showlist = self.api.fetch_list()
  File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 142, in fetch_list
    self.check_credentials()
  File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 133, in check_credentials
    response = self.opener.open("http://myanimelist.net/api/account/verify_credentials.xml")
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>

Change regex to identify movies/OVA (no episode number)

The current regex always tries to find an episode number, and if it doesn't it simply stops and logs as " The file format couldn't be recognized".
This conflicts with any movies, whether they are Anime or not, and any single OVA, since they do not have any episode.

E.g. "[Femme] Inari, Konkon, Koi Iroha - OVA [BD 720p Hi444PP AAC][AACB4CD1].mkv"

The regex could be changed to make the episode optional. In case it doesn't find it, assume episode 01, this way, MAL will accept once you update it. This should at least make the regex recognize more files.
While this certainly will make wMAL recognize files like "Batman Origins.mp4", at least it starts recognizing the right ones as well.
As a plus, if in a later update, wMAL integrates with other sites like a fictional "My iMDb List", then it will also be possible to use the same regex.

Since the regex is only going to be run once, I don't think there'll be any performance penalty. What are your thoughts?

Edit: Just checked and the IMDb List seems to be usable like MAL for Live-Action movies (not anime-related). Does it have a public API for changing it?

Edit2: IMDb List doesn't seem to have any public API for changing it... so I guess there's none yet...

wmal-qt changing score changes next entry when order changes

When a show's finished, it automatically, goes from "Watching" to "Completed"... but without any score. If a user changes it manually, as soon as "Update" is clicked and the update is over, two entries are changed in the list. One is the intended one (only changing the score), and the other one is the one next to the updated entry (which completely morphs into another copy of the same updated one). This only happens when the order of the list changed upon update (when ordered by score, for example). As after-effect, if you try to update the intended one once again (or its clone), it will update, but another clone will be on the list. A restart of the program is needed to go back to normal.

A summary of win32 issues

Since it's mentioned as a possible TODO item, I wanted to see how well the current git master of wMAL works on win32 as-is. The following is pretty much what I've got so far:

In all cases, the biggest issue is that Python on Windows is all kinds of nasty to get modules into. You can have Python on your PATH, but trying to call easy_install to get stuff installed doesn't work without explicitly navigating to its directory first (which is probably safest since who knows if it would end up in the right spot if easy_install was on the PATH).

In some cases, this requires downloading the packages manually and installing them. In other cases (like readline) it requires getting Python-oriented substitutions for GNU tools that don't ship with MSys/MinGW or Cygwin.

wmal.py: works perfectly, albeit with a bit of a cosmetic problem with the command prompt. See screenshot. I've used it successfully to sync, update, score, and change status while I've been in Windows.

wmal-curses.py: probably has the bulk of the issues with external modules not being present or needing workarounds to get working. I still haven't got it working; it's currently sitting at missing fcntl - Google seems to turn up the result that this needs to be altered to either use Windows system calls or to use some sort of platform-agnostic form. curses itself is known to be problematic or nonexistent on Windows, but there seem to be some alternatives that can be used.

wmal-gtk.py: not working either, but in seemingly different ways. If there is no 'lock' file in .wmal/mal, there are no warnings output to the Prompt, the outline of the window shows up, but not any of the internal window elements (I vaguely seem to remember that it does show up sometimes, or did at one point...not really sure). If 'lock' is present, there are warnings about the file locking that get output to the Prompt (see below), but now the window and all its internal decorations/elements show up, although it gets stuck in a loop and never loads any of the MAL content. Clicking the close button doesn't do anything, requiring me to close the Prompt instead. As mentioned, I seem to remember that the first time I ever tried launching the GTK interface, it was without 'lock' present, but the window was still correctly drawn (none of the content appeared, though).

>python27 wmal-gtk.py Starting engine... Locking database... Exception in thread Thread-1: Traceback (most recent call last): File "C:\WINDOWS\Python27\lib\threading.py", line 551, in __bootstrap_inner self.run() File "C:\WINDOWS\Python27\lib\threading.py", line 504, in run self.__target(*self.__args, **self.__kwargs) File "wmal-gtk.py", line 412, in task_start_engine self.engine.start() File "C:\dap\vid\Incoming Files\wmal-python\modules\engine.py", line 113, in start (self.api_info, self.mediainfo) = self.data_handler.start() File "C:\dap\vid\Incoming Files\wmal-python\modules\data.py", line 97, in start self._lock() File "C:\dap\vid\Incoming Files\wmal-python\modules\data.py", line 329, in _lock raise utils.DataFatal("Database is locked by another process. " DataFatal: Database is locked by another process. If you're sure there's no other process is using it, remove the file ~/.wmal/lock

scandir.py upgrade

You're shipping scandir 0.1, which (at least for me) does not work with OSX and https://github.com/benhoyt/scandir/blob/master/_scandir.c while 0.3 works as indented. :)

According to the commit log, there are API changes from 0.1 to 0.3 but at least searching for episodes works without changes (I just replaced the scandir.py file) and I guess scandir is used nowhere else(?)

wmal-gtk lexical ordering issue when sorting by a numerical column

It seems that ordering it by a numerical column (progress/score, but not percent), then it orders it using a lexical comparison. thus score 9 comes before 10, and progress 9/100 comes before 100/101 when ordering in descending order.
This only happens on wmal-gtk, all the others order it correctly.

Random bug when change anime in media player

Random bug in wMAL-Qt when change anime in Media Player (cmplayer):

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/wmal/engine.py", line 595, in tracker
    self._emit_signal('playing', self.last_show, False)
  File "/usr/lib/python2.7/site-packages/wmal/engine.py", line 114, in _emit_signal
    self.signals[signal](*args)
TypeError: _playing_show() takes exactly 4 arguments (3 given)

After this error, wMAL-Qt not detect when the chapter change in Cmplayer.

Engine hang on getting info for Hanamonogatari

Just double clicked on the show and it stuck on "Wait...". Happens in Qt and GTK.
Might have something to do with the alternative title "Monogatari Series: Second Season +α" being parsed wrong or something.
Here's the traceback:

libmal: Searching for Hanamonogatari...
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/wmal/ui/qtui.py", line 1734, in run
    ret = self.function(*self.args,**self.kwargs)
  File "/usr/lib/python2.7/site-packages/wmal/ui/qtui.py", line 1682, in _get_show_details
    details = self.engine.get_show_details(show)
  File "/usr/lib/python2.7/site-packages/wmal/engine.py", line 249, in get_show_details
    return self.data_handler.info_get(show)
  File "/usr/lib/python2.7/site-packages/wmal/data.py", line 396, in info_get
    return self.api.request_info([show])[0]
  File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 299, in request_info
    reslist = [ resultdict[itemid] for itemid in itemids ]
KeyError: 21855

PIL requirement missing

it seems like you forgot to add PIL as a requirement in the README. it's required for the image module used in ui/gtkui.py. technically just a requirement for the GTK application.

Player detection is confusing

"player" requires a binary filename as opposed to an absolute path. Entering a path produces regex errors.

The current behavior seems fine as it would permit any media player of the same binary name to be detected. I have a half-dozen different mplayer and mplayer2 repos on my install, all are detected as "mplayer" because they share the binary name.

However, if I want to use a GUI like smplayer, I still have to specify mplayer for detection to occur. This creates a problem as mplayer must specified without flags. In this case, if I use "Play" or "Play Next", mplayer (smplayer works in this situation) will start without sufficient flags for anime playback such as styled subtitles or the appropriate video output. Said "mplayer" also seems to be the system-wide mplayer.

VLC is not affected by this as much as mplayer as "vlc" defaults to the GUI. If I want to use vlc-cli, the no flags issue applies.

Crash wmal-curses on 403 errors retrieve list

Not really a bug per se, more of a small annoyance.

So lately the API has been returning a lot of 403 errors for me, which on it's own is pretty weird, but the main problem is, while wmal and wmal-gtk handle this error gracefully, wmal-curses just completely stops.

Example of traceback is:

Traceback (most recent call last):
File "/usr/bin/wmal-curses", line 9, in <module>
    wmal.ui.curses.main()
File "/usr/lib/python2.7/site-packages/wmal/ui/curses.py", line 959, in main
    wMAL_urwid()
File "/usr/lib/python2.7/site-packages/wmal/ui/curses.py", line 124, in __init__
    self.mainloop.run()
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 272, in run
    self.screen.run_wrapper(self._run)
File "/usr/lib/python2.7/site-packages/urwid/raw_display.py", line 242, in
    run_wrapper
    return fn()
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 337, in _run
    self.event_loop.run()
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 708, in run
    self._loop()
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 787, in _loop
    self._watch_files[fd]()
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 388, in _update
    self.process_input(keys)
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 494, in  
    process_input
    something_handled |= bool(self.unhandled_input(k))
File "/usr/lib/python2.7/site-packages/urwid/main_loop.py", line 540, in 
    unhandled_input
    return self._unhandled_input(input)
File "/usr/lib/python2.7/site-packages/wmal/ui/curses.py", line 236, in keystroke
    self.keymapping[input]()
File "/usr/lib/python2.7/site-packages/wmal/ui/curses.py", line 292, in do_retrieve
    self.engine.list_download()
File "/usr/lib/python2.7/site-packages/wmal/engine.py", line 662, in list_download
    self.data_handler.download_data()
File "/usr/lib/python2.7/site-packages/wmal/data.py", line 437, in download_data
    self.showlist = self.api.fetch_list()
File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 151, in fetch_list
    self.check_credentials()
File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 142, in 
    check_credentials
    response = self._request("http://myanimelist.net/api/account/verify_credentials.xml")
File "/usr/lib/python2.7/site-packages/wmal/lib/libmal.py", line 95, in _request
    raise utils.APIError("Connection error: %s" % e) 
    wmal.utils.APIError: Connection error: HTTP Error 403: Forbidden
Unloading...
Processing queue...
Logging in...
Can't process Kakumeiki Valvrave 2nd Season, will leave unsynced.

On Arch Linux x64, using latest commit.

I realise this isn't wmal's fault, but it would be nice if wmal-curses would handle these errors as gracefully as wmal and wmal-gtk do.

As a sidenote, connecting to the MAL API through a standard GET request through Firefox works fine, but all the clients I've tried are having trouble, so I don't know what that's about either.

Symlinked directories are not found by _search_video

For example, if my searchdir is /home/user/videos, and in that directory I have a symlinked folder to elsewhere (another drive, etc), it will not descend into that directory and say the episode could not be found.

wmal-qt unable to load cache list

After remaining offline for a few days, I tried to sync wmal, but when i opened it, it got stuck at "Data: Reading cache..."
Running in the terminal, I could see that it threw an exception cPickle.BadPickleGet

File "/usr/lib/python2.7/site-packages/wmal/data.py", line 436, in _load_cache
self.showlist = cPickle.load( open( self.cache_file , "rb" ) )
cPickle.BadPickleGet: 20�

I tried looking for something that looked like 20 + non-ASCII character, but I couldn't find anything in anime.list (which I believe it is the self.cache_file)
This is the 3rd time this happened after I've been offline for some time, losing maybe 10 or so shows that I don't remember to be able to update manually.
Is it possible to change from cPickle to something more standardized or something that it's easy to see what went wrong? I'm not sure, but maybe JSON?

If you can and you want, I can send my anime.list for debugging (assuming, there is no private info in it).

Edit: I labeled it wmal-qt... but it happens on all, since it's on data.py...

[GTK] searchdir path maxlength

The field in the gtk gui option dialog corresponding to 'searchdir' is limited by its length.

self.txt_player = gtk.Entry(32)
self.txt_searchdir = gtk.Entry(32)

You explicitly set the max input length in lines 990-991 so I assume there is a reason for it?

Make wMAL-gtk less intrusive

While it's fine to show a warning that the current regex did not work or that the show was not on the list, etc. it is UNBELIEVABLY ANNOYING to have it shown to you every 2 minutes while watching some movies. I used to to close wMAL before watching anything non-anime. But simply changing self.msg.warn to self.msg.info in engine.py makes it all work.

There are 3 messages that are quite annoying:

1- Found video but the file name format couldn't be recognized... line 632
2- The Player is not playing the next episode of %s... line 600
3- Found player but show not in list... line 657

Number 1 happens mostly while watching a movie (non-anime and anime because there is no episode number), and most things that are not anime, like some FLACs.
Number 2 happens mostly when rewatching an episode (like when showing someone the OP of an anime).
Number 3 happens everytime I'm watching something that is not anime-related but has an episode. E.g. Breaking Bad S01 - 01.avi

I really like wMAL, but these very intrusive warnings make it impossible to leave it open when I want to watch some movies or anything non-anime.
If you could please make these changes here, it would make it much easier for me to simply upgrade (Arch Linux), since it replaces any changes I've done before.
Thank you.

Configurable keymapping for curses TUI

I'm in need of a configurable keymapping since I like the curses tui most and some keys are already occupied by my system.

Here's my try. I thought about a good approach but found no perfect solution so I went with a pseudo functional one. Most probably due to the current time of day I failed to find the place where default configurations are written to disk. :S
05f0b11

Your opinions?

Sometimes UI crashes when auto-adding shows

As stated in the pull request, there's an issue with the gtk ui when shows are automatically added in the tracker, which is probably due to it being in a separate thread. The usual warning message is below, but there's sometime a crash ...


/usr/local/lib/python2.7/dist-packages/wmal/ui/gtkui.py:75: GtkWarning: /build/buildd/gtk+2.0-2.24.17/gtk/gtktreeview.c:6305 (do_validate_rows): assertion `gtk_tree_model_iter_next (tree_view->priv->model, &iter)' failed.
There is a disparity between the internal view of the GtkTreeView,
and the GtkTreeModel. This generally means that the model has changed
without letting the view know. Any display from now on is likely to
be incorrect.

gtk.main()


I might be just missing something in the gtk code ... but if it's really due to the threading, then one solution might be to emit a signal to the main gtk thread, rather than do the adding in the separate tracker thread.

Ability to give players arguments

When trying to specify arguments in the player input box, it tries to run literally, and will not play the file.
A second input field just for arguments would probably be a good way of doing it UI side, and maybe prepopulating it with good defaults for the player, e.g. mpv with --no-terminal, mplayer with --really-quiet, etc.
I only just realised that since wMAL was started with systemd, cgroups (damn their usefulness) would make mpv log reams of data to the journal about playback state.

Update message although the episode has already been updated

This is a rather small error (if it's even one). When using the Qt interface (don't know about the others), playing an episode you've already watched (and updated your list accordingly), wMAL will still show a message that "anime x will be updated to episode y in z minutes".

Minor detection bug

Episodes from the show called Mahouka get recognized as Hyouka episodes, in the case that there aren't any other Hyouka episodes around.
Reversely Hyouka episodes don't get recognized as Mahouka episodes.

Add/Delete support

Search/Add/Delete support should be implemented in the APIs, Engine and interfaces.
The interface could call a search function in the engine, and there the API could fetch the information.
Optionally the data handler could keep a cache.

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system

eric@gensokyo:~/wmal$ wmal-gtk 
/home/eric/.wmal/accounts
Starting engine...
Locking database...
Reading cache...
Reading info DB...
Reading queue...
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /home/eric/.gvfs
      Output information may be incomplete.
clearing gui
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /home/eric/.gvfs
      Output information may be incomplete.
select show
Searching for Kotoura-san 5...
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/wmal/ui/gtkui.py", line 447, in task_play
    played_ep = self.engine.play_episode(show)
  File "/usr/local/lib/python2.7/dist-packages/wmal/engine.py", line 471, in play_episode
    titles.extend(show['aliases'])
KeyError: 'aliases'

lsof: invalid regexp modifier

Suddenly I got spammed with these messages after I entered a absolute path for the player (starting with a /). I assume the problem is related to the behavior of the -c flag.
man lsof:

-c c     selects  the  listing  of  files  for  processes  executing the command that begins with the characters of c.
...
                If c begins and ends with a slash ('/'), the characters between the slashes are interpreted as a regular expression.  Shell meta-characters in the  regular  expres-
                sion must be quoted to prevent their interpretation by the shell.  The closing slash may be followed by these modifiers:

                     b    the regular expression is a basic one.
                     i    ignore the case of letters.
                     x    the regular expression is an extended one
                          (default).

engine.py, 597:

lsof = subprocess.Popen(['lsof', '-n', '-c', player, '-Fn'], stdout=subprocess.PIPE)

Therefore the playername could alter the behavior of lsof. Tbh I've got no idea how to work around this without escaping a huge list of possibilities from player. Maybe a separate config value for the playername to use here for filtering (besides player-path or something like that).

Possibility to start wMAL minimized

I'd be great if you could add an option to start wMAL minimized. If you have wMAL start along with your DE, it's sort of annoying that you'll always have to close it (to the tray) yourself.

Login

Whether I'm using my real account info or random login data, the result is always the same (for both, curses and GTK):

libmal: Logging in...
libmal: Downloading list...
Exception in thread Thread-1:
Traceback (most recent call last):
...
ParseError: mismatched tag: line 1, column 165

I'd suspect (just a guess) the login fails every time and he tries to parse some kind of returned error information. Any idea how I could track the problem down or confirm my theory? I don't know anything about the MAL API etc. :/

Use inotify (pyinotify) to watch file system access/changes

Instead of periodically checking if a player is open using lsof, it will be more efficient to just listen to file system events through the kernel.
It's possible to watch the player binary (which mpv) and listen for open events (actually running it) and close_nowrite events (closing it).
If desired, it can be used to watch the media folder for new files, thus we would only need to run the file name regex/transform only once per file, instead of every time we press play next or something like that (which i believe it's once per minute, as I get a "can't stat fuse.sshfs" warnings once I'm not on the same network as my search folder)

This is a small enhancement, but it would remove the periodical check, and make it possible to watch those less than 1 minute web anime (excluding opening/ending sequences) without making it check for the player every 30 seconds (even if setting the tracker_update_wait to 0).

Edit: This would impose a new requirement. The kernel needs inotify and pyinotify support which is only available to ≥ 2.6.13. Though I don't think this is a problem.

Edit2: For reference: https://github.com/seb-m/pyinotify

wMAL ignores file that was detected, but closed before updating.

If you try to watch something, and wMAL detects it, but you close it before it has a chance to update, then the message "Player was closed before update" will appear. This by itself it ok.
But if you open the same file, then wMAL will ignore it. Opening another file will be detected, and will allow the first file to be detected once again.

It seems like there is a "Last viewed file" variable that is not updated to None when the message "Player was closed before update" shows.

This happens a lot when I'm about to watch something, but something comes up and I close the player.
This happens on all... qt, gtk, curses, and cli... so I think this is probably on the engine.py

wmal-qt does not remember window size when closed/minimized to tray

If you maximize the window and then close/minimize to tray, the next time you open it, it will be using the default size again instead of being maximized.
Doesn't happen on the wmal-gtk (though it always starts not maximized).
I'm not too sure whether Qt provides this. I think it's necessary to remember the last position and last size before hiding, and then set them again after showing (as a plus, it's possible to implement, remember last window size and position)

Implement play tracker

Implement a timer in the engine that checks for any process playing a media file and update a show if necessary.
It should be able to communicate the update to the interface through the episode_changed signal.

[GTK] When syncing a newly added account, no notification of a 403 error.

When the below error is logged in the console, the GUI looks as pictured. The menus seem to work, but there is no indication that retrieving the list has failed.

Data: Locking database...
Data: Reading metadata...
libmal: Logging in...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 808, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 761, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/python2.7/site-packages/wmal/ui/gtkui.py", line 599, in task_start_engine
    self.engine.start()
  File "/usr/lib64/python2.7/site-packages/wmal/engine.py", line 133, in start
    (self.api_info, self.mediainfo) = self.data_handler.start()
  File "/usr/lib64/python2.7/site-packages/wmal/data.py", line 120, in start
    raise utils.APIFatal(e.message)
APIFatal: Connection error: HTTP Error 403: Forbidden

image

Alias Recognition In get_new_episode(self, showlist)

Although play_episode at line 462 is recognizing show aliases and will play episodes correctly, the function get_new_episode at line 446 does not. A workaround seems to be replacing lines 453 and 454 with lines 494 through 498.

Play and episode recognition?

Although the program is quite intuitive I feel like I've missed something important as I tried to use the "play" button beside the episode count in gtk gui and received a "Episode file not found." message. Is there a config I'm supposed to edit the location of my anime in, or set a media player?
http://z411.github.com/wmal-python/ also talks about "Detection of running media player, updates list if necessary" but the program didn't react when I played the latest episode of Mangirl in mplayer.

autodetection not working

No matter what I do the GTK UI does not do autodetection of anime playing in the background using mplayer. I always get "Engine: regex error, check logs". When using the non-curses commandline interface "play id" always finds the media file I am looking for.

I am using Arch Linux. Does it matter that the searchdir is an NFS mount for the regex matching to work?

In tabs with one item, that item will not update its status when selected

For example, if there is one item under the Watching tab, select it.
Then, switch tabs and select something else. The preview image and data should update.

Finally, switch back to the original tab and try to select the only item in it. The preview image and data will not update back to the originally selected item.

Additionally, clicking on that item will bring up the series info for the item that appears in the top status area.

image

Implement auto send and auto retrieve

Currently the changes made to the list are sent to the remote site manually and when the program is closed. Retrieving the list is done manually.

Implement an auto-send feature that triggers the queue flush automatically at a configurable limit (for example, when there are 5 pending changes in queue, auto-send everything) or periodically (once everyday, for example).

Same for retrieving list. Automatically flush queue and re-download the list periodically. This shouldn't be done too often unless the user updates his list in the website or with another client, so a default of 1 month could be good.

Regex improvements

(This is not meant as a request, more like a discussion about a possible improvement)

The current regex search (engine._search_video and utils.regex_find_file) is quite limited. Recent improvements work around adjusting the regex for special cases, though this might be a never ending story.

Additionally, this (the searchfile.replace stuff) only works in "one direction", i.e. when there are superfluous characters within the MAL episode name. Dealing with such things on the other side (the file names on your local disk) would require a transformation of each file name which might increase the search time.

Another issue is the requirement of a perfect match (well, basically), where a greedy/partial approach might be better. But then you run into the issue: which partial match is the best one?

Examples:

MAL name File name Issue
M3: Sono Kuroki Hagane M3 - Sono Kuroki Hagane You can deal with the : but not with the additional - without transforming every file name
Mangaka-san to Assistant-san to The Animation Mangaka-san to Assistant-san to A greedy/partial match would work
Ryuugajou Nanana no Maizoukin (TV) Ryuugajou Nanana no Maizoukin Same as above

(I omitted file name suffixes)

Which way to go? Further improving the regex and maybe applying some transformations for every file name found or < insert something better/new here >?

Searching does not work when unknown entity is present in titles

If the title of ANY of the search hits has any unknown entity, it will throw an exception and show and empty result list. The exception is as follows:

Search error: ExpatError(u'undefined entity ♥: line 195, column 19',)

This example happened when I searched for paradise.

Edit: This exception doesn't appear in the log, but rather as a message box when searching. Shouldn't this error also appear in the log?

Edit2: Just noticed that &hearts ; (without space) was a valid HTML entity.

Edit3: Just in case you're doing the same as the alpha entity, and just adding it to the parser. I think these cases should log the entity to be able to add it later, but it also should gracefully remove the entity to be able to search even though there are other unknown entities. This ♥ is not the only unknown entity I've encountered. Many of the shoujo animes use some sort of entity like if you search for princess or hime or high, you get ü and † and ³ as unknown entities respectively.

Dialog don't close when I press ok - qt

The options are saved, but the dialog window does not close.
Error Message:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/wmal/ui/qtui.py", line 1206, in s_save
    self._save()
  File "/usr/local/lib/python2.7/dist-packages/wmal/ui/qtui.py", line 1174, in _save
    engine.set_config('searchdir',  str(self.searchdir.text()))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 15: ordinal not in range(128)

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.