• R/O
  • SSH

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión0c8bf157617a2c4f485de269c2d0b731f06dfcd9 (tree)
Tiempo2018-01-15 07:05:47
AutorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@fast...>
CommiterJaime Marquínez Ferrándiz

Log Message

Sync song if the file is older that the current version in the library

Cambiar Resumen

Diferencia incremental

diff -r 7878ead34396 -r 0c8bf157617a beetsplug/playersync.py
--- a/beetsplug/playersync.py Wed Jan 03 19:27:44 2018 +0100
+++ b/beetsplug/playersync.py Sun Jan 14 23:05:47 2018 +0100
@@ -152,3 +152,14 @@
152152 copy_path = copy_path.decode()
153153 if not db.execute('SELECT * FROM song WHERE idSong=?', (item_id,)).fetchall():
154154 db.execute('INSERT INTO song (idSong, filename) VALUES (?,?)', (item_id, copy_path))
155+ else:
156+ # check if the file is outdated
157+ try:
158+ date = datetime.datetime.fromtimestamp(item.current_mtime())
159+ result = db.execute('SELECT * FROM song where idSong=? and synced=1 and date < ?', (item_id, date)).fetchone()
160+ except FileNotFoundError as ex:
161+ pass
162+ else:
163+ if result:
164+ self.info('There\'s a newer file for "{}"', item)
165+ db.execute('UPDATE song SET synced=0,date=NULL WHERE idSong=?', (item_id,))