Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
geigerzaehler committed Apr 1, 2024
1 parent ba1df80 commit 5858ad4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions beetsplug/alternatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


import argparse
import logging
import os.path
import threading
import traceback
Expand All @@ -29,6 +30,10 @@

import beetsplug.convert as convert

logger = logging.getLogger(__name__)
logger.propagate = True
logger.setLevel(logging.DEBUG)


def _remove(path, soft=True):
"""Remove the file. If `soft`, then no error will be raised if the
Expand Down Expand Up @@ -213,6 +218,17 @@ def item_change_actions(self, item: Item, path: bytes, dest: bytes) -> List[Acti
actions.append(Action.MOVE)

item_mtime_alt = os.path.getmtime(syspath(path))
item_mtime_lib = os.path.getmtime(syspath(item.path))
print(
"check mtime ",
{
"prev": path,
"prev2": syspath(path),
"mtime": item_mtime_alt,
"mtime_lib": item_mtime_lib,
"lib_path": syspath(item.path),
},
)
if item_mtime_alt < os.path.getmtime(syspath(item.path)):
actions.append(Action.WRITE)
album = item.get_album()
Expand Down
4 changes: 2 additions & 2 deletions test/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,13 @@ def test_move_after_path_format_update(self):
self.assertIsFile(old_path)

self.external_config["paths"] = {"default": "$album/$title"}
self.runcli("alt", "update", "myexternal")

item.load()
new_path = self.get_path(item)
self.assertIsNotFile(old_path)
self.assertIsFile(new_path)

def test_move_and_write_after_tags_changed(self):
def test_move_and_write_after_tags_changed_xxx(self):
item = self.add_external_track("myexternal")
old_path = self.get_path(item)
self.assertIsFile(old_path)
Expand All @@ -325,6 +324,7 @@ def test_move_and_write_after_tags_changed(self):
self.assertIsFile(new_path)
mediafile = MediaFile(syspath(new_path))
assert mediafile.title == "a new title"
assert False

def test_prune_after_move(self):
item = self.add_external_track("myexternal")
Expand Down

0 comments on commit 5858ad4

Please sign in to comment.