advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.23k stars 436 forks source link

[Enhancement]: Append tags from OPF file #602

Closed plague-doctor closed 2 years ago

plague-doctor commented 2 years ago

Describe the feature/enhancement

As audiobookshelf supports Tags, can we please add tags from OPF file?

I work on a scraper to generate OPF file for my audiobooks collection. I would love to be able to add the tags from opf automatically.

An example of my metadata.opf file looks like that:

<?xml version='1.0' encoding='utf-8'?>
<ns0:package xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ns0="http://www.idpf.org/2007/opf" version="2.0">
    <ns0:metadata>
        <dc:title>Narrenturm</dc:title>
        <dc:creator ns0:role="aut">Andrzej Sapkowski</dc:creator>
        <dc:creator ns0:role="nrt">zespół lektorów</dc:creator>
        <dc:date />
        <dc:publisher />
        <dc:identifier ns0:scheme="ISBN" />
        <dc:description>
Świat nie zginął i nie spłonął. Przynajmniej nie cały. 
Ale i tak było wesoło. 
[...] 
Przed nami jeszcze dwa tomy trylogii. </dc:description>
        <dc:language>pol</dc:language>
        <ns0:meta name="calibre:series" content="Trylogia husycka" />
        <ns0:meta name="calibre:series_index" content="1" />
        <dc:subject>fantasy</dc:subject>
        <dc:subject>science fiction</dc:subject>
        <dc:tag>Nagroda Zajdla - zwycięzca</dc:tag>
        <dc:tag>Husyci</dc:tag>
        <dc:tag>Reynewen</dc:tag>
        <dc:tag>czarna magia</dc:tag>
        <dc:tag>biała magia</dc:tag>
        <dc:tag>Śląsk</dc:tag>
    </ns0:metadata>
</ns0:package>
advplyr commented 2 years ago

I also had to check for the ns0 prefix you are using since this wasn't supported before. Same as genres it will only set the tags if they are empty or if you have "prefer OPF metadata" toggled on. opf-tags

advplyr commented 2 years ago

This is in v2.0.15

neingeist commented 2 years ago

great feature, thanks!

mariohi commented 11 months ago

@plague-doctor any chance you could share the code for scrapper? It looks like something I'm trying to achieve with lubimyczytac.pl

plague-doctor commented 11 months ago

Oh, being a systems admin, my code usually should be deposited to Sèvres as an example of how not to code, ever :-) Also, lubimy czytać frequently changes the website which renders scrapers nonoperational. I started to use audioteka.com/pl as they are more friendly. But if you want to take a bite, there is it: plague-doctor/scraper but as I have said above - prepare yourself to be greatly underwhelmed ;-)

izikeros commented 2 months ago

Would be good to have a metadata provider either libumyczytac or audioteka. I have created feature request in issue #3105.