View Issue Details

IDProjectCategoryView StatusLast Update
0011121MMW v4Framework: Scripts/Extensionspublic2013-09-18 22:33
Reporterzvezdan Assigned To 
PriorityurgentSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version4.1 
Target Version4.1Fixed in Version4.1 
Summary0011121: ISDBSongData::Path = ... is moving file and changing Path property without UpdateDB (reverted)
DescriptionAll SongData properties are updated only after UpdateDB, but that not apply to Path property which is updated immediately and file is moved even if UpdateDB is not used.
TagsNo tags attached.
Fixed in build1659

Relationships

related to 0011115 closedLudek Strange behavior of ISDBSongData object 
related to 0011226 closedLudek ISDBSongData::RenameByMask is moving file and changing Path property without UpdateDB 

Activities

peke

2013-08-03 22:34

developer   ~0037075

I confirmed this

Ludek

2013-08-13 12:55

developer   ~0037142

Fixed in build 1653.

peke

2013-08-17 00:06

developer   ~0037183

Verified 1653

Ludek

2013-09-16 09:59

developer   ~0037548

Re-opening, this should be reverted, reasons are here:
http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=73673

Ludek

2013-09-16 10:03

developer   ~0037549

Reverted in build 1659.

zvezdan

2013-09-16 12:30

updater   ~0037552

Well, that user has his reasons about this as I have mine. However, I think that his request has another solution that could be used instead, but mine cannot be done if Path property moves files immediately. He want to move files that are not inside of the Library and he could use ISDBFileSystem::MoveFile instead of the Path property.

I am not sure but I think that the only difference between MoveFile and Path is that Path moves additional files with the file specified in the Path property, e.g. .jpg cover files associated with the media file. If it is not the case, i.e. if Path property moves only the specified media file, then there is no reason to not use MoveFile method instead.

Actually, your solution is problematic from the start because you are using one SongData property for something that should be done using some additional method. I think that the Path property should modify only the value in the database, and you should have added one new method, e.g. SongData.MoveFile, if the current implementation of the Path property is moving some additional (cover) files or if it is doing some additional tasks beside of moving files, e.g. if it removes emptied folders.

By the way, your solution to change Path value only in the database without moving files setting the empty string to the Path property first is a bad programming practice caused with your refusal to add one additional method.

Ludek

2013-09-16 14:08

developer   ~0037556

OK, I agree that one could expect that setting Path won't move the file, but because the behaviour has been always documented here http://www.mediamonkey.com/wiki/index.php/ISDBSongData::Path and because by changing it we are breaking older scripts relying on it (as we can see), I would rather leave it as is.

I could add an additional method like PathNoMove, but it would be even more cumbersome than the trick documented (setting the empty string to the Path property first)

zvezdan

2013-09-16 15:51

updater   ~0037561

The solution with setting the empty string to the Path property first is not usable for me because my RegExp script could execute user-defined VBScript expressions that are unknown to me in the moment of writing script and some of them could modify Path during run-time.

Actually, it is not problem for me that we don't have one new method which would modify only Path value in the database without moving file. I agree that you should leave this property as it was because of compatibility. However, I would like to have similar property which would modify path (and move file) only after UpdateDB.

So, I have one another suggestion which would also resolve my another request (11226). You could add one new method e.g. SongData.PathByMask which would be like RenameByMask, but it would take effect (change Path in database and move file) only after UpdateDB. For example, if I want to get path of some track with applied mask, I would write something like this:
oSongData.PathByMask "e:\Music\%A\%S"
sText = oSongData.Path ' for displaying purposes
...
and when the script is ready to apply that modification it would execute oSongData.UpdateDB. However, if I want to discard that modification it would execute oSongData.DiscardChanges.

Of course, if that method is used with some normal path (e.g. c:\My Music\blah blah.mp3, without any tags like %A, %S...) it would behave like existing Path property when you set the same string to it, but with a difference that it is not modifying Path value in the database and moving file immediately.

Ludek

2013-09-17 16:42

developer   ~0037580

Added the new ISDBSongData::PathByMask method as described/requested

Added in build 1659.

peke

2013-09-18 22:33

developer   ~0037604

Verified 1659