Displaying PDF File - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8) +--- Thread: Displaying PDF File (/showthread.php?tid=7333) |
Displaying PDF File - GStevens - 01-22-2025 Most classical albums come with a PDF file containing information about the artist, composer, and the pieces included. Would it be possible to have an otion within Moode to display this? I know this has been requested before, but a while ago, so I wondered whether this was feasible now. Thanks, Geoff RE: Displaying PDF File - Tim Curtis - 01-22-2025 Yes technically it's possible. For example the simple JS code below will open a PDF file in a new Browser tab using the Browsers native PDF viewer. Code: window.open('PATH_TO_PDF_FILE'); [attachment=4367] The challenging part is the implementation because there a several moving parts. It would be something like this. In the file: /var/www/inc/mpd.php, function enhanceMetadata() there is the line below that gets the URL to the cover art image. Code: $current['coverurl'] = '/coverart.php/' . rawurlencode($song['file']); Add a new line right below it for example. Code: $current['pdfurl'] = getPDF($song['file']); Create the new function getPDF() in /var/www/inc/mpd.php. It accepts the path to the song file and returns the URL to a PDF file if it exists in the song file containing directory (the album directory). In file /var/www/js/playerlib.js at an appropriate location check the value of MPD.json['pdfurl'] and if its not blank then inject some html with id="SELECTOR-NAME" that would display a clickable badge [PDF] maybe in one of the lower corners of the cover art. Put the click handler somewhere in playerlib.js or scripts-panels.js Code: $(document).on('click', 'SELECTOR-NAME' function(e) { Maybe an interested dev will work out the details and contribute a PR to the repo :-) RE: Displaying PDF File - GStevens - 01-22-2025 Thanks for your reply Tim. I think that it would be a useful addition - here's hoping someone can take it up. Geoff |