-
Notifications
You must be signed in to change notification settings - Fork 0
/
MissedOnImport.py
41 lines (26 loc) · 1.03 KB
/
MissedOnImport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
This plugin creates a separate log of files that are ignored when on import and a separate log is created
for them
"""
from beets.plugins import BeetsPlugin
import os
import socket
from beets import config
from beets.ui import Subcommand
missedLogFile = '/home/travis/Apps/BeetsPlugin/beetsplug/missed.txt'
importMissedAlbums = Subcommand('importmissed', help='Import the album listed in the "missed" file')
def reImportMissed(lib, opts, args):
print "Reimported files/albums we missed the first time"
with open(missedLogFile) as f:
albums = f.readlines()
importMissedAlbums.func = reImportMissedAlbums
class MissedOnImport(BeetsPlugin):
def __init__(self):
print 'Init of new plugin!!'
@MissedOnImport.listen('import_task_choice')
def importmissed(session,task):
albumpath = task.paths
if task.choice_flag.name!='APPLY': # Album was not auto-corrected :(
with open(missedLogFile, "a") as myfile:
myfile.write(albumpath[0]+'\n') # Added to log
print task['path']#purposely kill import, so we can reimport for testing hehe