scripts / checkmusic /
Newer Older
41 lines | 1.178kb
petit script pour vérifier l...
Sébastien MARQUE authored on 2016-11-07
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
#
4
# piece of code modified from file metainfo.py from:
5
# CherryMusic - a standalone music server (http://github.com/devsnd/cherrymusic/) # Copyright (c) 2012 - 2016 Tom Wallroth & Tilman Boerner
6
# Thanks to them for their very nice music server
7
#
8
import sys
9
from tinytag import TinyTag
10

            
11
class Metainfo():
12
    def __init__(self, artist='', album='', title='', track='', length=0):
13
        self.artist = artist
14
        self.album = album
15
        self.title = title
16
        self.track = track
17
        self.length = length
18

            
19
    def dict(self):
20
        return {
21
            'artist': self.artist,
22
            'album': self.album,
23
            'title': self.title,
24
            'track': self.track,
25
            'length': self.length
26
        }
27

            
28
def getSongInfo(filepath):
amélioration de la sortie
Sébastien MARQUE authored on 2016-11-19
29
    print(filepath, end=": ")
petit script pour vérifier l...
Sébastien MARQUE authored on 2016-11-07
30
    try:
31
        tag = TinyTag.get(filepath)
32
    except LookupError:
33
        return Metainfo()
34
    for attribute in ['artist','album','title','track']:
35
        if getattr(tag, attribute) is None:
amélioration de la sortie
Sébastien MARQUE authored on 2016-11-19
36
            print(attribute, end=" ")
37
    print()
petit script pour vérifier l...
Sébastien MARQUE authored on 2016-11-07
38

            
39
if __name__ == "__main__":
40
    for filepath in sys.argv[1:]:
41
        getSongInfo(filepath)