Linking PDFs to Albums via Theme?
I am finally getting around to scanning my CD booklets. My entire collection is classical, and as you may know, classical CDs often have quite extensive booklets.
Initially I OCRd the booklets and included the electronic text in the “Personal notes/Review” field for the album. However, some booklets are too long and of course all formatting, images, etc. from the booklets is lost.
What I would like to do instead is convert each booklet into a single PDF file, and have a link on the album page in OrangeCD to the PDF file. As you know, OCD does not offer the functionality right now to add anything to an album except one cover image and then the media files.
I was wondering if it would be possible to achieve the desired result via programming of the theme. Not being a programmer, this may all be a pipedream, but if the PDF file is placed in the same directory as the media files, would it be possible to program the theme to look in the “Album path” directory for a file ending in “*.pdf” and then displaying a link to that file on the album page?
Any thoughts would be greatly appreciated.
BTW, this spring marks my 10 year anniversary using OCD...
1 Attachment(s)
Found a Way to Link to PDFs and Other File Types
I have figured out a way to link to PDF files (and other types of files) in OrangeCD. To make it happen, insert the attached code into your theme file, probably "Default V6.dax" located in "C:\OrangeCD\Templates", in the "::album/ui" section and before the following existing line (or anywhere else in the album section of the template):
<div class="section" id="lineup">
It works as follows.
(1) If media files are linked to an album, OrangeCD stores the path to the album's media folder in the tag called "path." This new code checks if that tag is populated. If it is not, nothing happens. (If you do not have media files linked to an album, you could theoretically use a custom field and manually type in a path and use the tag where that path is stored to link to external files. I wrote this for my own use and so am relying on the media folder.)
(2) If the path tag is populated, the code shows a new section entitled "External Files" on the album page, with a link entitled "View Files." Clicking that link shows all of the files in the album's media folder. You can then double-click on a file to open it. You could store a PDF file (or any other type of file) in the media folder and open it from here.
(3) I also wanted to open PDF liner notes from the album page directly without intermediate steps. If I have PDF liner notes, I save them in the album's media folder under the file name "Notes.PDF" and then enter "Liner Notes" in the "Condition" tag (found on the "Album Properties | Library" tab in OrangeCD). The code checks if the condition tag is not empty. If it is not empty (regardless of how it is populated), the code displays a link pointing to the "Notes.PDF" file located in the album's media folder. Clicking the link opens the PDF file. If the PDF file is not in the media folder, the link opens a "page not found" page. (I linked the display of the direct link to the PDF to the Condition tag because I use it to identify albums that have PDF files, but you could use any field, such as a custom field, for this purpose or eliminate the reliance on a populated field entirely to always show the link.)
Enjoy!