Code Monkey home page Code Monkey logo

flinck's Introduction

Yello there 👋

📖 Digest of my active open source repositories :

[chess] pawnhub: terminal listing of your online chess games results (2022) · [git] cesar: the radical compressor (2020) · [blog] Excommito: back-oriented jekyll template (2017) · [unixy] cronicle: time-spaced backups via cron (2017) · [unixy] F-dotfiles: opiniated dotfiles organization scheme based on stow (2016) · [media] flinck: sort your movies on filesystem using symlinks (2016) · [unixy] qifqif: enrich your .QIF files with categories. (2015) · [media] Replica: the id3 cloner (2012)
And also brack (2020 Dec), ublame (2020), imgimg (2019), etc.

🔥 Have a sneak-peek of future projects to come on my Discussions zone, and vote for the best one(s) ! ✊

flinck's People

Contributors

kraymer avatar

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

flinck's Issues

Use google search to find imdb id

some titles are not on omdb and could be resolved by a simple google custom search to get their imdb id

exemple: chateau ambulant, mon voisin totoro

Use parent dir to extract movie name when appropriate

if parent folder matches one of these tokens

('dvdrip', r'vost\w+', '1080p',
 '720p', 'multi',
 r'[\(\[]\D+[\)\]]',  # parentheses
 'bluray', 'x264', 'ac3',  # format
 r'b[dr]rip', 'xvid', 'divx', 'fansub',
 r'S\d+(E\d+)?',  # seasons
 r'(true)?french',  # langs
 'avi', 'mkv')])

then use it as a candidate for omdb search

Override section config for specific field value

An example is that for movies of kind 'TV series' : you may want to store them at another place than others movies.

genre:
    dirs: true
    buckets: true
    link_format: %rating-%year-%title

genre=TV series:
    root: TV/
    buckets: true
    link_format:  %rating-%season-%year-%title

Config should be herited from parent section except for redefined fields

Python3 compatibility

Is there any dependency that needs py27 to run?

Also, IMDB is a ridiculously large dependency to include to such a simple script (it installed at least 7 OTHER dependencies, all of which were huuuge, including Django, just to use the sqlAlchemy). Use OMDB instead.

https://github.com/dgilland/omdb.py

KeyError: u'rating'

WARNING: Found no folder defining a compatible range for '7.8'
WARNING: /wash/Movies/Top Rated/rating/Tangled (2010) [7.8] already exist
INFO: Tangled (2010).mkv: done
Traceback (most recent call last):
  File "/usr/bin/flinck", line 9, in <module>
    load_entry_point('flinck==0.3.1', 'console_scripts', 'flinck')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/flinck/__init__.py", line 90, in flinck_cli
    linker.flink(item)
  File "/usr/lib/python2.7/site-packages/flinck/linker.py", line 96, in flink
    self.link_format), item)
  File "/usr/lib/python2.7/site-packages/flinck/linker.py", line 25, in resolve_template
    path = path.replace(p, item[p.strip('%{}')])
KeyError: u'rating'

Which server is unavailable ?

I think that when some server is unavailable, flinck fails noisily (which is good). But which server failed ? The error message is hiding that detail :

flinck Videos/dns323/films_parents/
WARNING: Steven Spielberg - Indiana Jones et les aventuriers de l'arche perdue [DivX.Fr].avi: no result in Open Movie Database
Traceback (most recent call last):
  File "/usr/local/bin/flinck", line 9, in <module>
	load_entry_point('flinck==0.3.2', 'console_scripts', 'flinck')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
	return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
	rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
	return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
	return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flinck/__init__.py", line 87, in flinck_cli
	item = brain.search_filename(fpath, by)
  File "/usr/local/lib/python2.7/dist-packages/flinck/brain.py", line 141, in search_filename
	item = search_by(title, year, fields)
  File "/usr/local/lib/python2.7/dist-packages/flinck/brain.py", line 113, in search_by
	item = omdb.get(**query)
  File "/usr/local/lib/python2.7/dist-packages/omdb/api.py", line 23, in get
	return _client.get(**params)
  File "/usr/local/lib/python2.7/dist-packages/omdb/client.py", line 104, in get
	data = self.request(**params).json()
  File "/usr/local/lib/python2.7/dist-packages/omdb/client.py", line 60, in request
	res.raise_for_status()
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 825, in raise_for_status
	raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable

Extend flinck to work with series

Typically, I store my series episodes using series name, then numbering (which may be inconsistent)
as a consequence, I have, as an example, a bunch of Doctor.Who.2005.S01E01.FRENCH.BDRip.XviD-MiND.avi files.
But flinck will try to write them all in the same file :

So I get on one side Videos/flinck/genre/Adventure/Doctor Who -> Videos/dns323/Doctor_Who/Doctor.Who.2005.S01E01.FRENCH.BDRip.XviD-MiND.avi and on the other side a bunch of WARNING: /home/pi/Videos/flinck/genre/Adventure/Doctor Who already exist messages.

So, is it possible to add support for series and episodes to flinck ?
I think the typical pain point would be the support for seasons/episodes numbering, which would require some kind of regexp magick.

Non intuitive command arguments

python flinck.py --by "decade" monfilm.avi

flinck.py: error: argument --by: invalid choice

Because --by is a choicesarg, it must be located at the end, otherwise it considers the movie filename as a (bad) choice.

Install fails if you don't already have pyyaml in your virtualenv

pip install -e git+https://github.com/Kraymer/flinck\#egg\=flinck
Already using interpreter /usr/local/opt/python/bin/python2.7
New python executable in /Users/offby1/.local/venvs/flinck/bin/python2.7
Also creating executable in /Users/offby1/.local/venvs/flinck/bin/python
Installing setuptools, pip, wheel...done.
Obtaining flinck from git+https://github.com/Kraymer/flinck#egg=flinck
  Cloning https://github.com/Kraymer/flinck to ./.local/venvs/flinck/src/flinck
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/offby1/.local/venvs/flinck/src/flinck/setup.py", line 11, in <module>
        from flinck import __version__
      File "flinck/__init__.py", line 12, in <module>
        from . import confit
      File "flinck/confit.py", line 24, in <module>
        import yaml
    ImportError: No module named yaml

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /Users/offby1/.local/venvs/flinck/src/flinck/
Failed to pip install.  Aborting.

This is because in order to import the __version__ you pull in confit, which requires yaml... but that's in your install_requires

So this'll work in dev virtualenvs, but not without prep. I think you'll need to find a way to get the version without the import.

Enable formatting bucket and dirs option

The same way you can specify the link format
bucket and dirs folder should have a specific format
These fields could authorize true/false/string values, string being the format to use if no bucket found

decade:
    buckets: [%decade]
    link_format: %rating-%year-%title

Client Error: Unauthorized for url: http://www.omdbapi.com/?t=Kurenai+no+buta+AKA+Porco+Rosso&y=1992&page=1&plot=short&tomatoes=False

I get many errors when i try to use flinck. I've included those below. My intuition is that this is because the omdb api is not included in the url http://www.omdbapi.com/?t=Kurenai+no+buta+AKA+Porco+Rosso&y=1992&page=1&plot=short&tomatoes=False because when I visit it, I get a "No api key provided".
Traceback (most recent call last): File "C:\Users\Suleman\AppData\Local\Programs\Python\Python38-32\Scripts\flinck-script.py", line 11, in <module> load_entry_point('flinck==0.3.2', 'console_scripts', 'flinck')() File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 829, in __call__ return self.main(*args, **kwargs) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\flinck\__init__.py", line 87, in flinck_cli item = brain.search_filename(fpath, by) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\flinck\brain.py", line 141, in search_filename item = search_by(title, year, fields) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\flinck\brain.py", line 113, in search_by item = omdb.get(**query) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\omdb\api.py", line 23, in get return _client.get(**params) File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\omdb\client.py", line 106, in get data = self.request(timeout=timeout, **params).json() File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\omdb\client.py", line 55, in request res.raise_for_status() File "c:\users\suleman\appdata\local\programs\python\python38-32\lib\site-packages\requests\models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://www.omdbapi.com/?t=Kurenai+no+buta+AKA+Porco+Rosso&y=1992&page=1&plot=short&tomatoes=False

Store md5 caches of processed files

have a json cache to read to discard already linked files in watch mode

When you run flinck periodically on your Library folder, ideally you would want it spend time only on the new files.

Add interactive mode

Succession of tries to find movie infos :

  • search from filename
  • if google api key: search from imdb fetched using google custom engine
  • (in interactive mode only) search from folder name
    • if google api key: search from imdb fetched using google custom engine
  • (in interactive mode only) enter movie name/imdb id manually

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.