Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tags to metadata.abs #1469

Merged
merged 4 commits into from
Feb 2, 2023

Conversation

yuuzhan
Copy link
Contributor

@yuuzhan yuuzhan commented Feb 2, 2023

Modified the reading / saving of metadata.abs to allow for the reading and writing of tags. Used JSON functions to stringify the objects to handle escape characters automatically, then JSON.parse to get it back in.

Tried to make the read / write as error proof as possible so it would function with files that do not have the tags entity in the metadata file.

@Hallo951
Copy link
Contributor

Hallo951 commented Feb 2, 2023

Oh great verry thanks, I've been waiting for this for a while. How can I update older abs files so that the tags are also saved in this one?

@yuuzhan
Copy link
Contributor Author

yuuzhan commented Feb 2, 2023

Oh great verry thanks, I've been waiting for this for a while. How can I update older abs files so that the tags are also saved in this one?

At this time you have to manually trigger an update on each metadata file. This should happen automatically when you modify a field in the library entry. Depending on your library size, I might suggest doing a bulk edit and appending a temporary tag to all entries then saving them all. Ive done this kind of operation with 300-400 items and it takes quite a few minutes to complete (you might have to click "Wait" when your browser prompts you to kill the tab as it thinks its stuck)

@advplyr
Copy link
Owner

advplyr commented Feb 2, 2023

I hesitated on adding tags to this file because the whole abmetadata file concept needs to be re-written.

As it stands now tags will be the only key in there that is using JSON, which is weird. JSON is preferred because we ran into issues using genres with commas because the current abmetadata file expects comma separated genres.

That being said I just cleaned this up for release since it is being asked for. I made updates to your original logic

@advplyr advplyr merged commit d1b25da into advplyr:master Feb 2, 2023
@yuuzhan
Copy link
Contributor Author

yuuzhan commented Feb 3, 2023

I was sensing that was what you were planning however I wanted to do something and I needed tags in the file for now.

I debated refactoring some of the other code to make it JSON and not CSV but thought better of doing too much at once :p

I had also written some code to dump out LibraryItem.Book.ToJSON() into metadata.json. that would be simple to pull those both in and out in total without having as much logic around reading and writing, but not sure about the efficiency of the application overall doing that

@yuuzhan yuuzhan deleted the adding-tags-to-metadata.abs branch February 7, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants