Editing series settings causes unintended directory rename

Post any problems / bugs / issues that are Mylar-related in here.
Post Reply
qubidt
Posts: 6
Joined: Fri Jun 18, 2021 2:54 pm

Editing series settings causes unintended directory rename

Post by qubidt »

Separate but seemingly related issues affecting a fresh install (on a Linux system) w/ the current latest release: v0.6.9:
  • When editing the settings for a series for the first time, the "Directory Location" setting is always ignored (changing other settings work as expected). Changing "Directory Location" only works if the settings have already been "Updated" once (even if nothing was changed). i.e., the following workaround is required:
    • Add a new series
    • Series page -> Edit Settings -> Update (no actual changes required)
    • Series page -> Edit Settings -> Change "Directory Location" -> Update
  • When changing (only) the "Force-Type" setting for a series, the "Directory Location" is reset according to mylar rules. So any existing "Directory Location" setting is overridden and the series directory is moved. Additionally, this means that the "Force-Type" and "Directory Location" settings cannot be changed at the same time
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Editing series settings causes unintended directory rename

Post by evilhero »

The first problem has already been addressed here in the python3-dev branch, but has not made it into the master branch as of yet.

The 2nd problem is definitely present, which may also be occurring if the series hasn't fully loaded yet after initially adding. The problem is that when you add a series and then you go immediately to the series page it looks fine and you can see the loading banners. However, the 2nd tab (edit settings) does not properly load any values, even after the series has completed being added (meaning the 1st tab will be updated and correct issues will be displaying, but the 2nd tab is all blank/None values).

The temporary solution to the 2nd problem might be to do a simple page refresh after the series has completed being added. Changing the directory and booktypes thereafter should allow it to take the values as entered and apply them, but it also may not (haven't tested that aspect obviously).

If you enacted to test the page refresh out and see if that helps, let me know the outcome. Otherwise I can look into this more when I have some free time this weekend
qubidt
Posts: 6
Joined: Fri Jun 18, 2021 2:54 pm

Re: Editing series settings causes unintended directory rename

Post by qubidt »

Ah, thank you. I did try to do a search but I missed the github issue. That's good to know.

As for the second issue, that's not the cause of the issue with the directory being renamed. Given a series that has a manually-set path (which doesn't match the default), changing the book type causes seems to always reset the directory location. For example, given the page for this manga, and having previously overridden the directory path:
  • click series.json
  • ctrl-shift-r to hard refresh the page
  • change the book type to GN (from previously-overridden 'TPB')
  • browser makes this request:

    Code: Select all

    GET 
    https://mylar/comic_config?ComicID=144815&age_rating=All&force_type=GN&comic_version=None&com_location=/media/comics/Manga/A Returner's Magic Should be Special (2022)&alt_search=None&alt_filename=None&publisher_imprint=None&fuzzy_year=0
  • book type has been changed to GN but directory was also moved back to its default location

    Code: Select all

    /media/comics/Manga/A Returner's Magic Should be Special (2022) --> /media/comics/Manga/A Returners Magic Should be Special (2022)
  • click series.json again
debug logs follows (although it's not very helpful):

Code: Select all

02-Sep-2022 12:16:32 - INFO    :: mylar.toggleVerbose.5513 : CP Server Thread-3 : Verbose (DEBUG) logging is enabled
02-Sep-2022 12:16:32 - DEBUG   :: mylar.toggleVerbose.5514 : CP Server Thread-3 : If you can read this message, debug logging is now working
02-Sep-2022 12:16:32 - INFO    :: mylar.toggleVerbose.5517 : CP Server Thread-3 : config file has been loaded from: /config/config.ini
02-Sep-2022 12:18:20 - DEBUG   :: mylar.update_metadata.66 : CP Server Thread-8 : metainfo_loaded: {'version': '1.0.1', 'metadata': {'type': 'comicSeries', 'publisher': 'Yen Press', 'imprint': None, 'name': "A Returner's Magic Should be Special", 'comicid': 144815, 'year': 2022, 'description_text': '“Now that I’m back, I won’t allow my loved ones to die again!“ The Shadow World - the most catastrophic existence humanity has faced in history. Desir Arman is one of the six remaining survivors of mankind within it. The six attempt to clear the final level of the labyrinth but ultimately fail, and the world comes to an end. However - when Desir thought he would meet his demise, what is revealed before him is the world... thirteen years ago?! Desir is returned to the past, back to the time when he enrolled at the nation’s finest magic academy - Havrion. He is reunited with his precious friends, and is prepared to change the past to save the world and his loved ones...! Three years remaining before the emergence of the Shadow World! Change the past and gather strong comrades to save mankind!English translation of the Korean manhwa Gwihwanjaui Mabeobeun Teukbyeolhaeya Hamnida (귀환자의 마법은 특별해야 합니다', 'description_formatted': '“Now that I’m back, I won’t allow my loved ones to die again!“ The Shadow World - the most catastrophic existence humanity has faced in history. Desir Arman is one of the six remaining survivors of mankind within it. The six attempt to clear the final level of the labyrinth but ultimately fail, and the world comes to an end. However - when Desir thought he would meet his demise, what is revealed before him is the world... thirteen years ago?! Desir is returned to the past, back to the time when he enrolled at the nation’s finest magic academy - Havrion. He is reunited with his precious friends, and is prepared to change the past to save the world and his loved ones...! Three years remaining before the emergence of the Shadow World! Change the past and gather strong comrades to save mankind!English translation of the Korean manhwa Gwihwanjaui Mabeobeun Teukbyeolhaeya Hamnida (귀환자의 마법은 특별해야 합니다', 'volume': None, 'booktype': 'Print', 'age_rating': None, 'collects': None, 'ComicImage': 'https://comicvine.gamespot.com/a/uploads/original/11160/111600871/8636527-8235255120-97819.jpg', 'total_issues': 1, 'publication_run': 'August 2022 - Present', 'status': 'Continuing'}}
02-Sep-2022 12:18:20 - DEBUG   :: mylar.update_metadata.191 : CP Server Thread-8 : Successfully written series.json file to /media/comics/Manga/A Returner's Magic Should be Special (2022)
02-Sep-2022 12:18:38 - INFO    :: mylar.comic_config.6829 : CP Server Thread-11 : AgeRating: All
02-Sep-2022 12:18:38 - DEBUG   :: mylar.comic_config.6876 : CP Server Thread-11 : Attempting to rename existing location [/media/comics/Manga/A Returner's Magic Should be Special (2022)]
02-Sep-2022 12:18:38 - INFO    :: mylar.comic_config.6886 : CP Server Thread-11 : Renaming directory: /media/comics/Manga/A Returner's Magic Should be Special (2022) --> /media/comics/Manga/A Returners Magic Should be Special (2022)
02-Sep-2022 12:18:38 - DEBUG   :: mylar.comic_config.6912 : CP Server Thread-11 : Updated Series options!
02-Sep-2022 12:18:38 - INFO    :: mylar.comicDetails.360 : CP Server Thread-5 : Detected root directory changes @ /media/comics/Manga/A Returners Magic Should be Special (2022) - running them down
02-Sep-2022 12:18:38 - INFO    :: mylar.forceRescan.1133 : CP Server Thread-5 : [FILE-RESCAN] Now checking files for A Returner's Magic Should be Special (2022) in /media/comics/Manga/A Returners Magic Should be Special (2022)
02-Sep-2022 12:18:38 - INFO    :: mylar.traverse_directories.1572 : CP Server Thread-5 : there are 1 files.
02-Sep-2022 12:18:38 - DEBUG   :: mylar.listFiles.149 : CP Server Thread-5 : [FILENAME]: A Returner's Magic Should be Special v01 (2022) (Digital) (LuCaZ).cbz
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.447 : CP Server Thread-5 : NEWLY SPLIT REORGD: ['A', 'Returnerg11s', 'Magic', 'Should', 'be', 'Special', 'v01', '(2022)', '(Digital)', '(LuCaZ)']
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.514 : CP Server Thread-5 : Exception match: A
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.537 : CP Server Thread-5 : Possible alpha numeric issue (or non-numeric only). Testing my theory.
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.539 : CP Server Thread-5 : [A] Removing possible alpha issue leaves:  (Should be a numeric)
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.715 : CP Server Thread-5 : volume label detected as : Volume 01 @ position: 6
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.484 : CP Server Thread-5 : checking date : 2022
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.492 : CP Server Thread-5 : date: 2022
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.851 : CP Server Thread-5 : datecheck: [{'date': '2022', 'position': 7, 'mod_position': -1}]
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.857 : CP Server Thread-5 : sctd: 2022
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.865 : CP Server Thread-5 : year verified as : None
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.873 : CP Server Thread-5 : year verified as: 2022
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.915 : CP Server Thread-5 : highest_series_position: 7
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.1013 : CP Server Thread-5 : issue_position: 10
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.1036 : CP Server Thread-5 : Possible UNKNOWN TPB/GN/HC {One-Shot} detected. Volume assumption is number: {'position': 6, 'volume': '01'}
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.1059 : CP Server Thread-5 : Volume detected as : v01
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.1176 : CP Server Thread-5 : sf_highest_series_pos: ['A', 'Returnerg11s', 'Magic', 'Should', 'be', 'Special']
02-Sep-2022 12:18:38 - DEBUG   :: mylar.parseit.1228 : CP Server Thread-5 : series title possibly: A Returner's Magic Should be Special
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1221 : CP Server Thread-5 : No issues with identical issue numbering were detected for this series
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1351 : CP Server Thread-5 : [FILE-RESCAN] [944514] Issue match - fcdigit: 1000 ... int_iss: 1000
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1444 : CP Server Thread-5 : [FILE-RESCAN] Matched...issue: A Returner's Magic Should be Special#1 --- 1000
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1449 : CP Server Thread-5 : [FILE-RESCAN] .......filename: A Returner's Magic Should be Special v01 (2022) (Digital) (LuCaZ).cbz
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1450 : CP Server Thread-5 : [FILE-RESCAN] .......filesize: 80899198
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1674 : CP Server Thread-5 : [haves] issue_status_generation took 0:00:00.004119
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1683 : CP Server Thread-5 : [haves] issue_status_writing took 0:00:00.002054
02-Sep-2022 12:18:38 - DEBUG   :: mylar.forceRescan.1774 : CP Server Thread-5 : [nothaves] issue_status_generation_time_taken: 0:00:00.002158
02-Sep-2022 12:18:38 - INFO    :: mylar.forceRescan.1788 : CP Server Thread-5 : [FILE-RESCAN] Total files located: 1
02-Sep-2022 12:18:38 - INFO    :: mylar.forceRescan.1939 : CP Server Thread-5 : [FILE-RESCAN] I have physically found 1 issues, ignored 0 issues, snatched 0 issues, and accounted for 0 in an Archived state [ Total Issue Count: 1 / 1 ]
02-Sep-2022 12:19:04 - DEBUG   :: mylar.update_metadata.66 : CP Server Thread-4 : metainfo_loaded: {'version': '1.0.1', 'metadata': {'type': 'comicSeries', 'publisher': 'Yen Press', 'imprint': 'None', 'name': "A Returner's Magic Should be Special", 'comicid': 144815, 'year': 2022, 'description_text': '“Now that I’m back, I won’t allow my loved ones to die again!“ The Shadow World - the most catastrophic existence humanity has faced in history. Desir Arman is one of the six remaining survivors of mankind within it. The six attempt to clear the final level of the labyrinth but ultimately fail, and the world comes to an end. However - when Desir thought he would meet his demise, what is revealed before him is the world... thirteen years ago?! Desir is returned to the past, back to the time when he enrolled at the nation’s finest magic academy - Havrion. He is reunited with his precious friends, and is prepared to change the past to save the world and his loved ones...! Three years remaining before the emergence of the Shadow World! Change the past and gather strong comrades to save mankind!English translation of the Korean manhwa Gwihwanjaui Mabeobeun Teukbyeolhaeya Hamnida (귀환자의 마법은 특별해야 합니다', 'description_formatted': '“Now that I’m back, I won’t allow my loved ones to die again!“ The Shadow World - the most catastrophic existence humanity has faced in history. Desir Arman is one of the six remaining survivors of mankind within it. The six attempt to clear the final level of the labyrinth but ultimately fail, and the world comes to an end. However - when Desir thought he would meet his demise, what is revealed before him is the world... thirteen years ago?! Desir is returned to the past, back to the time when he enrolled at the nation’s finest magic academy - Havrion. He is reunited with his precious friends, and is prepared to change the past to save the world and his loved ones...! Three years remaining before the emergence of the Shadow World! Change the past and gather strong comrades to save mankind!English translation of the Korean manhwa Gwihwanjaui Mabeobeun Teukbyeolhaeya Hamnida (귀환자의 마법은 특별해야 합니다', 'volume': None, 'booktype': 'TPB', 'age_rating': 'All', 'collects': None, 'ComicImage': 'https://comicvine.gamespot.com/a/uploads/original/11160/111600871/8636527-8235255120-97819.jpg', 'total_issues': 1, 'publication_run': 'August 2022 - Present', 'status': 'Continuing'}}
02-Sep-2022 12:19:05 - DEBUG   :: mylar.update_metadata.191 : CP Server Thread-4 : Successfully written series.json file to /media/comics/Manga/A Returners Magic Should be Special (2022)
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Editing series settings causes unintended directory rename

Post by evilhero »

Maybe I'm not following entirely here, but the value in the com_location field in the url you pasted, shows the exact same directory as it was previously (it did not have the booktype present) - so it wouldn't be renamed (unless you're saying you changed the directory at the same time as the change to GN)

The directory will only be renamed to include the booktype if you have the $Type variable specified in your folder format (and you have the format_booktype = True in the ini). Otherwise, changing the booktype would have no effect on the directory itself (as it goes to rename it but it's identical so it doesn't).

I'm trying to remember, but I also believe that if you manually alter the directory location for a series (and its different than what would be automatically generated based on your folder format string), it will not perform a rename based on series changes as that gets rather confusing for it to determine what is valid vs what should is not.

The changes for the initial problem #1 you specified, also had some handling for booktype changes so that may also be already fixed in the dev branch - as like you said the 2 issues are similar, but different enough to warrant different considerations.
qubidt
Posts: 6
Joined: Fri Jun 18, 2021 2:54 pm

Re: Editing series settings causes unintended directory rename

Post by qubidt »

evilhero wrote: Fri Sep 02, 2022 11:40 pm Maybe I'm not following entirely here, but the value in the com_location field in the url you pasted, shows the exact same directory as it was previously (it did not have the booktype present) - so it wouldn't be renamed (unless you're saying you changed the directory at the same time as the change to GN)
For my example, the mylar default dir name is "A Returners Magic Should be Special (2022)" (no apostrophe) which I changed to "A Returner's Magic Should be Special". Sorry, I should have done an example with a more obvious change, it would have made this easier to talk about.

I'll illustrate with a fresh mylar instance with all default configuration (and running from the latest dev branch commit 52f95ca2):

I added a comic series, hard-refreshed, changed the Directory Location (this now works correctly the first try), hard-refreshed, changed "Force-Type" from Print to TPB. The last action also causes the directory location to be reset to its default. Here are the logs with the HTTP requests inserted where they were performed:

Code: Select all

03-Sep-2022 15:50:06 - INFO    :: mylar.addComictoDB.636 : mass-add : Sucessfully added War for Earth-3 (2022) to the watchlist
GET http://localhost:8090/comic_config?ComicID=141755&age_rating=All&comic_version=None&com_location=/tmp/comics/XXX (2022)&alt_search=None&alt_filename=None&publisher_imprint=None&fuzzy_year=0
03-Sep-2022 15:51:25 - INFO    :: mylar.comic_config.6829 : CP Server Thread-3 : AgeRating: All
03-Sep-2022 15:51:25 - DEBUG   :: mylar.comic_config.6890 : CP Server Thread-3 : Attempting to rename existing location [/tmp/comics/War for Earth-3 (2022)]
03-Sep-2022 15:51:25 - INFO    :: mylar.comic_config.6900 : CP Server Thread-3 : Renaming directory: /tmp/comics/War for Earth-3 (2022) --> /tmp/comics/XXX (2022)
03-Sep-2022 15:51:25 - DEBUG   :: mylar.comic_config.6926 : CP Server Thread-3 : Updated Series options!
GET http://localhost:8090/comic_config?ComicID=141755&age_rating=All&force_type=TPB&comic_version=None&com_location=/tmp/comics/XXX (2022)&alt_search=None&alt_filename=None&publisher_imprint=None&fuzzy_year=0
03-Sep-2022 15:52:55 - INFO    :: mylar.comic_config.6829 : CP Server Thread-3 : AgeRating: All
03-Sep-2022 15:52:55 - DEBUG   :: mylar.comic_config.6890 : CP Server Thread-3 : Attempting to rename existing location [/tmp/comics/XXX (2022)]
03-Sep-2022 15:52:55 - INFO    :: mylar.comic_config.6900 : CP Server Thread-3 : Renaming directory: /tmp/comics/XXX (2022) --> /tmp/comics/War for Earth-3 (2022)
03-Sep-2022 15:52:55 - DEBUG   :: mylar.comic_config.6926 : CP Server Thread-3 : Updated Series options!
as you can see, the only difference between the two `/comic_config` requests was the additional `&force_type=TPB`
qubidt
Posts: 6
Joined: Fri Jun 18, 2021 2:54 pm

Re: Editing series settings causes unintended directory rename

Post by qubidt »

Seems like the source of the issue is this block here, which is only being run in the case where `force_type` was set. This causes `com_location` to change from the user-specified one (`XXX`) to the standard path. The later check for `orig_location != com_location` causes the actual rename.

I'm not familiar with all the conditions here so I'm not sure what the actual fix would be.
Post Reply