├── .dockerignore
├── .gitignore
├── .includepath
├── .project
├── .settings
├── .jsdtscope
├── org.eclipse.ltk.core.refactoring.prefs
├── org.eclipse.wst.jsdt.ui.superType.container
└── org.eclipse.wst.jsdt.ui.superType.name
├── LICENSE
├── README.md
├── build-docker.sh
├── build
├── docker
│ ├── Dockerfile
│ ├── README.md
│ ├── install.sh
│ └── ttmp32gme
├── mac
│ └── ttmp32gme.app
│ │ └── Contents
│ │ ├── Info.plist
│ │ ├── MacOS
│ │ └── ttmp32gme
│ │ └── Resources
│ │ ├── AppSettings.plist
│ │ ├── MainMenu.nib
│ │ ├── designable.nib
│ │ └── keyedobjects.nib
│ │ ├── appIcon.icns
│ │ └── script
└── win
│ └── ttmp32gme.ico
├── buildit.pl
├── docker-compose.yml
├── docker-push.sh
├── lib
├── licenses
│ ├── ffmpeg
│ │ ├── COPYING.GPLv2.txt
│ │ ├── COPYING.GPLv3.txt
│ │ ├── COPYING.LGPLv2.1.txt
│ │ ├── COPYING.LGPLv3.txt
│ │ └── LICENSE.md.txt
│ ├── tttool_LICENSE.txt
│ └── wkhtmltopdf_LICENSE.txt
├── mac
│ ├── ffmpeg
│ ├── libcharset.1.0.0.dylib
│ ├── libgmp.10.dylib
│ ├── libiconv.2.4.0.dylib
│ ├── libiconv.dylib
│ ├── libz.1.2.11.dylib
│ └── tttool
└── win
│ ├── ffmpeg.exe
│ ├── tttool.exe
│ └── wkhtmltopdf.exe
├── resources
├── ttmp32gme_icon.pdf
├── ttmp32gme_icon.png
├── ttmp32gme_logo.pdf
└── ttmp32gme_logo.png
├── src
├── TTMp32Gme
│ ├── Build
│ │ ├── FileHandler.pm
│ │ ├── Mac.pm
│ │ ├── Perl.pm
│ │ └── Win.pm
│ ├── DbUpdate.pm
│ ├── LibraryHandler.pm
│ ├── PrintHandler.pm
│ └── TttoolHandler.pm
├── assets
│ ├── css
│ │ ├── bootstrap.min.css
│ │ ├── continue.gif
│ │ ├── edit.gif
│ │ ├── fine-uploader-new.min.css
│ │ ├── fine-uploader-new.min.css.map
│ │ ├── loading.gif
│ │ ├── pause.gif
│ │ ├── print.css
│ │ ├── processing.gif
│ │ ├── retry.gif
│ │ └── trash.gif
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ └── glyphicons-halflings-regular.woff2
│ ├── images
│ │ ├── Screen_Shot_cd-booklet.jpg
│ │ ├── Screen_Shot_list.jpg
│ │ ├── Screen_Shot_print-config.png
│ │ ├── Screen_Shot_tiles.jpg
│ │ ├── favicon.ico
│ │ ├── not_available-generic.png
│ │ ├── oid-table.png
│ │ ├── ttmp32gme_logo.png
│ │ ├── waiting-generic.png
│ │ └── white.png
│ └── js
│ │ ├── bootstrap.min.js
│ │ ├── jquery-3.1.1.min.js
│ │ ├── jquery-ui.min.js
│ │ ├── jquery.fine-uploader.min.js
│ │ ├── jquery.fine-uploader.min.js.map
│ │ ├── jquery.matchHeight-min.js
│ │ └── print.js
├── build.txt
├── config.html
├── config.sqlite
├── help.html
├── library.html
├── oid_cache
│ ├── 2047-24-1200-2.png
│ ├── 2048-24-1200-2.png
│ ├── 2049-24-1200-2.png
│ ├── 2050-24-1200-2.png
│ ├── 2051-24-1200-2.png
│ ├── 2052-24-1200-2.png
│ ├── 2053-24-1200-2.png
│ ├── 2054-24-1200-2.png
│ ├── 2055-24-1200-2.png
│ ├── 2056-24-1200-2.png
│ ├── 2057-24-1200-2.png
│ ├── 2058-24-1200-2.png
│ ├── 2059-24-1200-2.png
│ ├── 2060-24-1200-2.png
│ ├── 2061-24-1200-2.png
│ ├── 2062-24-1200-2.png
│ ├── 2063-24-1200-2.png
│ ├── 2064-24-1200-2.png
│ ├── 2065-24-1200-2.png
│ ├── 2663-24-1200-2.png
│ ├── 2664-24-1200-2.png
│ ├── 2665-24-1200-2.png
│ ├── 2666-24-1200-2.png
│ ├── 2667-24-1200-2.png
│ ├── 3944-24-1200-2.png
│ ├── 3945-24-1200-2.png
│ ├── 3946-24-1200-2.png
│ ├── 3947-24-1200-2.png
│ └── 920-24-1200-2.png
├── templates
│ ├── base.html
│ ├── pdf.html
│ ├── print.html
│ └── printing_contents.html
├── ttmp32gme.pl
├── update_version.pl
└── upload.html
└── tools
└── mp3split.sh
/.dockerignore:
--------------------------------------------------------------------------------
1 | dist/
2 | build/mac/
3 | build/win/
4 | lib/
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /blib/
2 | /.build/
3 | _build/
4 | cover_db/
5 | inc/
6 | Build
7 | !Build/
8 | Build.bat
9 | .last_cover_stats
10 | /Makefile
11 | /Makefile.old
12 | /MANIFEST.bak
13 | /META.yml
14 | /META.json
15 | /MYMETA.*
16 | nytprof.out
17 | /pm_to_blib
18 | *.o
19 | *.bs
20 | /_eumm/
21 | .DS_Store
22 | ._*
23 |
24 | /src/library/*
25 | dist/
26 | build/current/
27 | .vscode/
28 |
--------------------------------------------------------------------------------
/.includepath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ttmp32gme
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.validation.validationbuilder
10 |
11 |
12 |
13 |
14 | org.epic.perleditor.perlbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.epic.perleditor.perlnature
21 | org.eclipse.wst.jsdt.core.jsNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 thawn
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ttmp32gme
2 | a platform independent tool (inspired by the [windows tool ttaudio](https://github.com/sidiandi/ttaudio) ) to create tiptoi gme files from mp3 files. Also creates a printable sheet to play the music.
3 |
4 | ## Features
5 | * convert music/audiobook albums from mp3 to gme format playable with the tiptoi pen using [tttool](http://tttool.entropia.de/).
6 | * automatic generation of control sheets that allow to control playback of music/audiobook.
7 | * flexible print layouts for various applications (see [screenshots](#screenshots) below).
8 | * Printing was tested to work with Chrome and Firefox on Mac Os and Microsoft Edge on Windows 10 (Chrome and Firefox do not print with high enough resolution on Win 10, Opera seems to work occasionally).
9 | * Creation of printable PDFs on Windows systems.
10 | * automatic readout of id3 tags to get album and track info (including embedded cover images).
11 | * add cover images for nicer print layout.
12 | * copy gme files to tiptoi if tiptoi is connected.
13 |
14 | ## Installation
15 | * Mac/Win: download the executables from the [releases page](https://github.com/thawn/ttmp32gme/releases). Put them somewhere and run them. Open localhost:10020 with a browser of your choice (except Internet Explorer).
16 | * linux:
17 | * docker (recommended):
18 | * Using the provided installer: download (right click and save as...) [install.sh](https://raw.githubusercontent.com/thawn/ttmp32gme/master/build/docker/install.sh) and [ttmp32gme](https://raw.githubusercontent.com/thawn/ttmp32gme/master/build/docker/ttmp32gme) into the same directory on our computer.
19 | Run `sudo bash install.sh` in a terminal in the same directory where you saved the files.
20 | Afterwards, you can start ttmp32gme with `ttmp32gme start` and stop it with `ttmp32gme stop`.
21 | If your tiptoi is mounted but not recognized, you can add the tiptoi path to the start command: `ttmp32gme start /path/to/tiptoi`
22 | * Using docker directly: There is [a docker image on the docker hub](https://hub.docker.com/r/thawn/ttmp32gme).
23 | Open the port to the ttmp32gme web interface by adding `--publish 8080:8080` to your `docker run` command.
24 | You can specify where the library should be stored by adding `--volume ~/.ttmp32gme:/var/lib/ttmp32gme`.
25 | Also, you can make a mounted tiptoi accessible by adding `--volume /tiptoi/mount/point:/mnt/tiptoi`.
26 |
27 | A complete docker run command could look like this: `docker run -d --rm --publish 8080:8080 --volume ~/.ttmp32gme:/var/lib/ttmp32gme --volume /media/${USER}/tiptoi:/mnt/tiptoi --name ttmp32gme thawn/ttmp32gme:latest`
28 |
29 | Alternatively you can use [docker compose](https://docs.docker.com/compose/) and startup ttmp32gme with `docker-compse up` using the [docker-compose.yml](https://raw.githubusercontent.com/thawn/ttmp32gme/master/docker-compose.yml).
30 | * native: run the perl sources (see [instructions](#required-libraries-and-perl-modules-for-running-ttmp32gme-from-source) below)
31 |
32 | ## Usage
33 | ### 1. Add mp3 files
34 | Add one or more mp3 files on the "Upload" page. Only add one
35 | album at a time.
36 |
37 | ### 2. Configure and create gme files
38 | On the "Library" page, you can configure and create gme
39 | files. Mp3 tag data of recently uploaded files will automatically be used to
40 | pre-populate the artist, album title and track info.
41 |
42 | ### 3. Print the control page(s)
43 | Once you choose to print one or more album from the library,
44 | a new page will open that displays the albums and their tracks from the gme
45 | files that you selected for printing.
46 |
47 | You can customize the the print layout by clicking on " Configure print layout".
49 |
50 | You can choose one of the three presets:
51 |
52 | list
53 | : A list layout that includes all album details.
54 |
55 | tiles
56 | : A tiled layout that includes only minimal album details and general controls that work with all albums.
57 |
58 | CD booklet
59 | : A layout that is optimized for printing CD booklets.
60 |
61 | Alternatively, you can manually choose which parts (cover image, album
62 | information, album control buttons, track list) to display, how many columns
63 | should be used and how large each album should be when printed.
64 |
65 | You can also configure here which resolution should be used (in DPI) for
66 | printing (start with the maximum resolution your printer can handle). And how
67 | many pixels (in x and y direction) each dot of the OID code should use. Start
68 | with a value of 2 (read
69 | this if you want to know why ). If you have problems with not recognized oid
70 | codes, first try to increase the number of pixels to 3 or 4 and then try to
71 | change the resolution setting.
72 |
73 | #### If the pen does not recognize the printed pages
74 |
75 | It is a known (and sad) fact that the oid codes do not work with all printers. This is because the oid codes are very fine detailed patterns and need to be reproduced exactly by the printer. Many printers simply do not have a good enough resolution or their drivers mess around with the patterns during image processing. In the latter case, this can sometimes be circumvented by playing around with the print settings but sometimes, it simply does not work.
76 |
77 | * Make sure to print at 100% scale. Do not use the "autoscaling" or "fit to paper" settings in your print dialog.
78 | * print in 1200dpi if possible, sometimes 600dpi seem to work, too
79 | * play around with the quality settings, resolution, contrast
80 | * use different paper
81 | * try black-and-white versus color prints
82 | * Try to set your print driver to Graphic/Image mode (some drivers mess up the oid patterns in text mode).
83 | * If your driver does not have such a setting, try to convert the PDF to a 1200 dpi png and print that.
84 |
85 | Before [reporting any problem with the pen not recognizing printed pages](https://github.com/thawn/ttmp32gme/issues/11), please read the wiki page on printer support for tttool:
86 | https://github.com/entropia/tip-toi-reveng/wiki/Printing
87 |
88 | If possible, please try to print the oid table you can download below:
89 |
90 | [oid-table](https://cloud.githubusercontent.com/assets/1308449/26282853/beefeec2-3e19-11e7-8413-86a26bb1b1b5.png) (borrowed from tttool).
91 |
92 | When you point the pen at any of the patterns, it should say something like "Bitte installieren Sie erst die Audiodatei für dieses Produkt" or "Bitte berühre erst das Anschaltzeichen für dieses Produkt". Then at least the pen recognized that these are oid codes. If the pen does nothing, this likely means that your issue is unrelated to the software but is a problem with the printer.
93 |
94 | If you still think it is a software issue, please report exactly (step by step) what you were doing and what (if any) messages the pen is saying, otherwise I cannot help you.
95 |
96 | ### 4. Copy the gme files onto the tiptoi pen
97 | Connect the tiptoi pen to your computer. If you do not see the button "Copy
98 | selected to TipToi", reload the library page. Now select
99 | the desired albums and click on "Copy selected to TipToi". Wait till the
100 | operation completes and a message appears that tells you that it is safe to
101 | disconnect the pen from the computer.
102 |
103 | ## Screenshots
104 | ### Print as detailed list
105 | 
106 |
107 | ### Print as tiles (fits many albums on one page)
108 | 
109 |
110 | ### Print as CD booklet (fits into standard CD cases)
111 | 
112 |
113 | ### Print configuration
114 | 
115 |
116 |
117 | ## Required libraries and perl modules (for running ttmp32gme from source)
118 |
119 | ### Required libraries
120 | ttmp32gme requires the following libraries to run"
121 | `libc6`, `libxml2`, `zlib`
122 | on a debian (-based) system (including Ubuntu), you can install these by running:
123 | `sudo apt-get install libc6-dev libxml2-dev zlib1g-dev`.
124 |
125 | If you want to use the ogg format, you need `ffmpeg`:
126 | `sudo apt-get install ffmpeg`.
127 |
128 |
129 | On linux systems, pdfs can be created using wkhtmltopdf if version 0.13.x is found on the path (i.e. in /usr/local/bin or /usr/bin).
130 |
131 | You also need to [install tttool](https://github.com/entropia/tip-toi-reveng#installation) and copy/link the resulting binary into your path.
132 |
133 | ### Required perl modules
134 | Run `cpan -i` (or the equivalent tool from your distro such as g-cpan for gentoo) followed by the following
135 | modules (some modules required the `-f` flag to install on my Mac OS system):
136 |
137 | EV
138 | AnyEvent::HTTPD
139 | Path::Class
140 | Cwd
141 | File::Basename
142 | File::Find
143 | List::MoreUtils
144 | PAR
145 | Encode
146 | Text::Template
147 | JSON::XS
148 | URI::Escape
149 | Getopt::Long
150 | Perl::Version
151 | DBI
152 | DBIx::MultiStatementDo
153 | Log::Message::Simple
154 | Music::Tag::MP3
155 | Music::Tag::OGG
156 | Music::Tag::MusicBrainz
157 | Music::Tag::Auto
158 | MP3::Tag
159 | Image::Info
160 |
161 | ### Running ttmp32gme from source
162 |
163 | Once you have all the required perl modules installed, check out the git repository into a directory of your choice:
164 | `git clone https://github.com/thawn/ttmp32gme.git`.
165 |
166 | Then run the main ttmp32gme perl script:
167 | `cd ttmp32gme/src`
168 | `perl ttmp32gme.pl`.
169 |
170 | Now you should be able to access the ttmp32gme user interface (http://localhost:10020) using your web browser.
171 |
172 | ### Build requirements (for building mac and windows binaries)
173 |
174 | For building from source, you also need:
175 |
176 | pp
177 |
178 | ## Web Links
179 | * [tttool home page](http://tttool.entropia.de/)
180 | * [tttool manual](https://tttool.readthedocs.io/de/latest/)
181 | * [ttaudio](https://github.com/sidiandi/ttaudio/)
182 | * [scienceblogs.de article on astrodicticum-simplex](http://scienceblogs.de/astrodicticum-simplex/2018/03/15/die-sternengeschichten-als-hoerbuch-auf-dem-tiptoi-stift/)
183 | * [Caschys Blog](https://stadt-bremerhaven.de/tiptoi-stift-eigene-hoerspiele-und-musik-mit-ttmp32gme/)
184 | * [It Dad](https://it-dad.de/2019/01/24/eigene-tiptoi-hoerbuecher-und-alben/)
185 | * [TipToi Fahrzeugerkundung der Kinderfeuerwehr](https://www.ffrh.de/tiptoi-projekt/)
186 |
187 |
188 | ## ToDo
189 | * integrate wkhtml2pdf into docker image for linux
190 | * save last selected albums in the browsers local storage
191 | * import/migrate library from one computer to another
192 |
193 | ### Maybe later
194 | * add and remove music files from library page
195 | * automatic splitting of audio files as described [here.](https://stackoverflow.com/questions/36074224/how-to-split-video-or-audio-by-silent-parts)
196 | * automatic download of cover images
197 | * enable separate printing of oid codes/text and cover images
198 | * run on a real webserver so that users can generate their gme files online (thanks to Joachim for the idea).
199 | * per-track images
200 |
--------------------------------------------------------------------------------
/build-docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | docker image build -t ttmp32gme -f build/docker/Dockerfile .
--------------------------------------------------------------------------------
/build/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM thawn/ttmp32gme-deps
2 |
3 | WORKDIR /ttmp32gme
4 | COPY src .
5 | ENV APPDATA=/var/lib/
6 | RUN mkdir config ${APPDATA}/ttmp32gme /mnt/tiptoi
7 |
8 | EXPOSE 8080
9 |
10 | CMD perl ttmp32gme.pl --debug=2 --host=0.0.0.0 --port=8080 --configdir=/ttmp32gme/config
11 | # HEALTHCHECK --interval=5m --timeout=3s \
12 | # CMD curl -f http://localhost:8080/ || exit 1
13 |
--------------------------------------------------------------------------------
/build/docker/README.md:
--------------------------------------------------------------------------------
1 | A docker image for ttmp32gme.
2 |
3 | Set the environment variable `HOST=0.0.0.0` to make ttmp32gme accessible to other computers in your network.
4 |
5 | ```
6 | docker run -d \
7 | --rm \
8 | --publish 8080:8080 \
9 | --volume ${ttmp32gmeStorage}:/var/lib/ttmp32gme \
10 | --volume /dev/null 2>&1 || { echo >&2 "Docker must be installed and in your path. Please refer to your packet manager or https://docs.docker.com/install/ for how to install docker. Aborting."; exit 1; }
7 |
8 | chmod a+x ttmp32gme
9 | target=/usr/local/bin
10 |
11 | if [ -d "$target" ] && [[ :$PATH: == *:"${target}":* ]]; then
12 | cp ttmp32gme "$target"
13 | else
14 | cp ttmp32gme /usr/bin
15 | fi
16 | echo "Successfully installed ttmp32gme."
--------------------------------------------------------------------------------
/build/docker/ttmp32gme:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 | ttmp32gmeStorage=~/.ttmp32gme
3 | mkdir -p ${ttmp32gmeStorage}
4 | volumes="--volume ${ttmp32gmeStorage}:/var/lib/ttmp32gme"
5 | usage="Usage: $0 [path-to-mounted-tiptoi]"
6 | if [ ! "$1" = "start" ] && [ ! "$1" = "stop" ]; then
7 | echo "$usage"
8 | exit 0
9 | elif [ -w "${2}/tiptoi.ico" ]; then
10 | echo "Found tiptoi: ${2}"
11 | volumes="${volumes} --volume ${2}:/mnt/tiptoi"
12 | elif [ -w "/mnt/tiptoi/tiptoi.ico" ]; then
13 | echo "Found tiptoi: /mnt/tiptoi/"
14 | volumes="${volumes} --volume /mnt/tiptoi:/mnt/tiptoi"
15 | elif [ -w "/media/${USER}/tiptoi/tiptoi.ico" ]; then
16 | echo "Found tiptoi: /media/${USER}/tiptoi"
17 | volumes="${volumes} --volume /media/${USER}/tiptoi:/mnt/tiptoi"
18 | elif [ -w "/media/removable/tiptoi/tiptoi.ico" ]; then
19 | echo "Found tiptoi: /media/removable/tiptoi"
20 | volumes="${volumes} --volume /media/removable/tiptoi:/mnt/tiptoi"
21 | fi
22 | if [ "$1" = "start" ]; then
23 | docker run -d \
24 | --rm \
25 | --publish 8080:8080 \
26 | ${volumes} \
27 | --name ttmp32gme \
28 | thawn/ttmp32gme:latest && \
29 | echo "Successfully started ttmp32gme. Open http://localhost:8080 in your browser to continue."
30 | else
31 | docker stop ttmp32gme && \
32 | echo "Successfully stopped ttmp32gme."
33 | fi
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ttmp32gme
9 | CFBundleIconFile
10 | AppIcon.icns
11 | CFBundleIdentifier
12 | org.korten.ttmp32gme
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ttmp32gme
17 | CFBundleShortVersionString
18 | 1.0.1
19 | CFBundleVersion
20 | 1
21 | LSMinimumSystemVersion
22 | 10.8.0
23 | LSUIElement
24 |
25 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 |
30 | NSHumanReadableCopyright
31 | © 2020 Till Korten
32 | NSMainNibFile
33 | MainMenu
34 | NSPrincipalClass
35 | NSApplication
36 |
37 |
38 |
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/MacOS/ttmp32gme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/build/mac/ttmp32gme.app/Contents/MacOS/ttmp32gme
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/Resources/AppSettings.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/build/mac/ttmp32gme.app/Contents/Resources/AppSettings.plist
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/Resources/MainMenu.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/build/mac/ttmp32gme.app/Contents/Resources/MainMenu.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/Resources/appIcon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/build/mac/ttmp32gme.app/Contents/Resources/appIcon.icns
--------------------------------------------------------------------------------
/build/mac/ttmp32gme.app/Contents/Resources/script:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ./ttmp32gme
--------------------------------------------------------------------------------
/build/win/ttmp32gme.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/build/win/ttmp32gme.ico
--------------------------------------------------------------------------------
/buildit.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 |
3 | # Building with pp does NOT WORK with perl v5.10.0
4 | # v5.10.0 will produce strange behavior in PAR applications
5 | # Use Perl v5.10.1 and above only.
6 |
7 | use File::Copy::Recursive qw(dircopy);
8 | use Path::Class;
9 | use Cwd;
10 |
11 | use Data::Dumper;
12 |
13 | my $filesToAdd = "";
14 |
15 | my $copyTo = dir( cwd, 'build', 'current' );
16 | $copyTo->mkpath();
17 | my $copyFrom = dir(cwd);
18 |
19 | print "Copying source files into build/current\n\n";
20 |
21 | my $assetsList = "";
22 | my $templatesList = "";
23 | $filesToAdd .= " -a assets.list -a templates.list";
24 |
25 | my $src_dir = dir('src');
26 | $src_dir->recurse(
27 | callback => sub {
28 | my ($source) = @_;
29 | my @components = $source->components();
30 | shift @components;
31 | if ( -d $source ) {
32 | ( dir( $copyTo, @components ) )->mkpath();
33 | } elsif ( -f $source && $source->basename() !~ /^\./ ) {
34 | my $file = file(@components);
35 | $source->copy_to( file( $copyTo, $file ) );
36 | $file = $file->as_foreign('Unix');
37 | print $file. "\n";
38 | $filesToAdd .= " -a " . qq($file);
39 | if ( $file =~ /^assets/ ) {
40 | $assetsList .= "$file\n";
41 | } elsif ( $file =~ /^templates/ ) {
42 | $templatesList .= "$file\n";
43 | }
44 | }
45 | }
46 | );
47 |
48 | ( file( $copyTo, 'assets.list' ) )->spew($assetsList);
49 |
50 | ( file( $copyTo, 'templates.list' ) )->spew($templatesList);
51 |
52 | my $lib_dir = dir( $copyTo, 'lib' );
53 | $lib_dir->mkpath();
54 |
55 | if ( $^O =~ /MSWin/ ) {
56 | use Win32::Exe;
57 | print "\nWindows build.\n\n";
58 |
59 | ( file( 'build', 'win', 'ttmp32gme.ico' ) )->copy_to( file( $copyTo, 'ttmp32gme.ico' ) );
60 |
61 | ( dir( 'lib', 'win' ) )->recurse(
62 | callback => sub {
63 | my ($source) = @_;
64 | my $name = $source->basename();
65 | if ( -f $source && $name !~ /^\./ ) {
66 | $source->copy_to( file( $lib_dir, $name ) );
67 | print 'lib/' . $name . "\n";
68 | $filesToAdd .= " -a " . qq(lib/$name);
69 | }
70 | }
71 | );
72 |
73 | chdir($copyTo);
74 |
75 | my $addDlls = '-l libxml2-2__.dll -l libiconv-2__.dll -l zlib1__.dll -l liblzma-5__.dll';
76 |
77 | my $result = `pp -M Win32API::File -c $addDlls $filesToAdd -o ttmp32gme.exe ttmp32gme.pl`;
78 |
79 | # newer versions of pp don't support the --icon option any more, use Win32::Exe to manually replace the icon:
80 | # $exe = Win32::Exe->new('ttmp32gme.exe');
81 | # $exe->set_single_group_icon('ttmp32gme.ico');
82 | # $exe->write;
83 |
84 | print $result;
85 | if ( $? != 0 ) { die "Build failed.\n"; }
86 |
87 | chdir('..\..');
88 | my $distdir = dir('dist');
89 | $distdir->mkpath();
90 |
91 | ( file( $copyTo, 'ttmp32gme.exe' ) )->copy_to( file( $distdir, 'ttmp32gme.exe' ) );
92 | `explorer dist`;
93 | print "Build successful.\n";
94 |
95 | } elsif ( $^O eq 'darwin' ) {
96 | print "\nMac OS X build.\n\n";
97 |
98 | ( dir( 'lib', 'mac' ) )->recurse(
99 | callback => sub {
100 | my ($source) = @_;
101 | my $name = $source->basename();
102 | if ( -f $source && $name !~ /^\./ ) {
103 | $source->copy_to( file( $lib_dir, $name ) );
104 | print 'lib/' . $name . "\n";
105 | $filesToAdd .= ' -a ' . 'lib/' . $name;
106 | }
107 | }
108 | );
109 |
110 | chdir($copyTo);
111 |
112 | my $result = `/usr/local/bin/pp -c $filesToAdd -o mp32gme ttmp32gme.pl`;
113 |
114 | print $result;
115 | if ( $? != 0 ) { die "Build failed.\n"; }
116 |
117 | chdir('../..');
118 | my $distdir = dir('dist');
119 | $distdir->mkpath();
120 | my $app_dir = dir( $distdir, 'ttmp32gme.app' );
121 | dircopy( ( dir( 'build', 'mac', 'ttmp32gme.app' ) )->stringify, ($app_dir)->stringify );
122 | ( file( $copyTo, 'mp32gme' ) )->copy_to( file( $app_dir, 'Contents', 'Resources', 'ttmp32gme' ) );
123 | `open dist`;
124 | print "Build successful.\n";
125 | } else {
126 | print
127 | "Unsupported platform. Try installing the required perl modules and running the script out of the src folder.\n"
128 | . "Maybe even send in a patch with a build script for your platform.\n";
129 | }
130 |
131 | print "Cleaning build folders.\n";
132 | $copyTo->rmtree();
133 |
134 | print "Done.\n";
135 | exit(0);
136 |
137 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.7"
2 | services:
3 | ttmp32gme:
4 | image: thawn/ttmp32gme:latest
5 | volumes:
6 | - ~/.ttmp32gme:/var/lib/ttmp32gme
7 | - /media/${USER}/tiptoi:/mnt/tiptoi
8 | ports:
9 | - '8080:8080'
10 | expose:
11 | - '8080'
12 |
--------------------------------------------------------------------------------
/docker-push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | docker tag ttmp32gme thawn/ttmp32gme
3 | docker push thawn/ttmp32gme
4 | echo "now create a version tag and push that one:"
5 | echo "docker tag ttmp32gme thawn/ttmp32gme:version-1.0.1"
6 | echo "docker push thawn/ttmp32gme:version-1.0.1"
7 |
--------------------------------------------------------------------------------
/lib/licenses/ffmpeg/COPYING.GPLv2.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/lib/licenses/ffmpeg/COPYING.LGPLv3.txt:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/lib/licenses/ffmpeg/LICENSE.md.txt:
--------------------------------------------------------------------------------
1 | # License
2 |
3 | Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
4 | or later (LGPL v2.1+). Read the file `COPYING.LGPLv2.1` for details. Some other
5 | files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
6 | FFmpeg.
7 |
8 | Some optional parts of FFmpeg are licensed under the GNU General Public License
9 | version 2 or later (GPL v2+). See the file `COPYING.GPLv2` for details. None of
10 | these parts are used by default, you have to explicitly pass `--enable-gpl` to
11 | configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
12 |
13 | Specifically, the GPL parts of FFmpeg are:
14 |
15 | - libpostproc
16 | - optional x86 optimization in the files
17 | - `libavcodec/x86/flac_dsp_gpl.asm`
18 | - `libavcodec/x86/idct_mmx.c`
19 | - `libavfilter/x86/vf_removegrain.asm`
20 | - the X11 grabber in `libavdevice/x11grab.c`
21 | - the following building and testing tools
22 | - `compat/solaris/make_sunver.pl`
23 | - `doc/t2h.pm`
24 | - `doc/texi2pod.pl`
25 | - `libswresample/swresample-test.c`
26 | - `tests/checkasm/*`
27 | - `tests/tiny_ssim.c`
28 | - the following filters in libavfilter:
29 | - `vf_blackframe.c`
30 | - `vf_boxblur.c`
31 | - `vf_colormatrix.c`
32 | - `vf_cover_rect.c`
33 | - `vf_cropdetect.c`
34 | - `vf_delogo.c`
35 | - `vf_eq.c`
36 | - `vf_find_rect.c`
37 | - `vf_fspp.c`
38 | - `vf_geq.c`
39 | - `vf_histeq.c`
40 | - `vf_hqdn3d.c`
41 | - `vf_interlace.c`
42 | - `vf_kerndeint.c`
43 | - `vf_mcdeint.c`
44 | - `vf_mpdecimate.c`
45 | - `vf_owdenoise.c`
46 | - `vf_perspective.c`
47 | - `vf_phase.c`
48 | - `vf_pp.c`
49 | - `vf_pp7.c`
50 | - `vf_pullup.c`
51 | - `vf_repeatfields.c`
52 | - `vf_sab.c`
53 | - `vf_smartblur.c`
54 | - `vf_spp.c`
55 | - `vf_stereo3d.c`
56 | - `vf_super2xsai.c`
57 | - `vf_tinterlace.c`
58 | - `vf_uspp.c`
59 | - `vsrc_mptestsrc.c`
60 |
61 | Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
62 | the configure parameter `--enable-version3` will activate this licensing option
63 | for you. Read the file `COPYING.LGPLv3` or, if you have enabled GPL parts,
64 | `COPYING.GPLv3` to learn the exact legal terms that apply in this case.
65 |
66 | There are a handful of files under other licensing terms, namely:
67 |
68 | * The files `libavcodec/jfdctfst.c`, `libavcodec/jfdctint_template.c` and
69 | `libavcodec/jrevdct.c` are taken from libjpeg, see the top of the files for
70 | licensing details. Specifically note that you must credit the IJG in the
71 | documentation accompanying your program if you only distribute executables.
72 | You must also indicate any changes including additions and deletions to
73 | those three files in the documentation.
74 | * `tests/reference.pnm` is under the expat license.
75 |
76 |
77 | ## External libraries
78 |
79 | FFmpeg can be combined with a number of external libraries, which sometimes
80 | affect the licensing of binaries resulting from the combination.
81 |
82 | ### Compatible libraries
83 |
84 | The following libraries are under GPL:
85 | - frei0r
86 | - libcdio
87 | - librubberband
88 | - libvidstab
89 | - libx264
90 | - libx265
91 | - libxavs
92 | - libxvid
93 |
94 | When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
95 | passing `--enable-gpl` to configure.
96 |
97 | The OpenCORE and VisualOn libraries are under the Apache License 2.0. That
98 | license is incompatible with the LGPL v2.1 and the GPL v2, but not with
99 | version 3 of those licenses. So to combine these libraries with FFmpeg, the
100 | license version needs to be upgraded by passing `--enable-version3` to configure.
101 |
102 | ### Incompatible libraries
103 |
104 | There are certain libraries you can combine with FFmpeg whose licenses are not
105 | compatible with the GPL and/or the LGPL. If you wish to enable these
106 | libraries, even in circumstances that their license may be incompatible, pass
107 | `--enable-nonfree` to configure. But note that if you enable any of these
108 | libraries the resulting binary will be under a complex license mix that is
109 | more restrictive than the LGPL and that may result in additional obligations.
110 | It is possible that these restrictions cause the resulting binary to be
111 | unredistributable.
112 |
113 | The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are
114 | incompatible with the GPLv2 and v3. To the best of our knowledge, they are
115 | compatible with the LGPL.
116 |
117 | The NVENC library, while its header file is licensed under the compatible MIT
118 | license, requires a proprietary binary blob at run time, and is deemed to be
119 | incompatible with the GPL. We are not certain if it is compatible with the
120 | LGPL, but we require `--enable-nonfree` even with LGPL configurations in case
121 | it is not.
122 |
--------------------------------------------------------------------------------
/lib/licenses/tttool_LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 Joachim Breitner
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/lib/licenses/wkhtmltopdf_LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/lib/mac/ffmpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/ffmpeg
--------------------------------------------------------------------------------
/lib/mac/libcharset.1.0.0.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/libcharset.1.0.0.dylib
--------------------------------------------------------------------------------
/lib/mac/libgmp.10.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/libgmp.10.dylib
--------------------------------------------------------------------------------
/lib/mac/libiconv.2.4.0.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/libiconv.2.4.0.dylib
--------------------------------------------------------------------------------
/lib/mac/libiconv.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/libiconv.dylib
--------------------------------------------------------------------------------
/lib/mac/libz.1.2.11.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/libz.1.2.11.dylib
--------------------------------------------------------------------------------
/lib/mac/tttool:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/mac/tttool
--------------------------------------------------------------------------------
/lib/win/ffmpeg.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/win/ffmpeg.exe
--------------------------------------------------------------------------------
/lib/win/tttool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/win/tttool.exe
--------------------------------------------------------------------------------
/lib/win/wkhtmltopdf.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/lib/win/wkhtmltopdf.exe
--------------------------------------------------------------------------------
/resources/ttmp32gme_icon.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/resources/ttmp32gme_icon.pdf
--------------------------------------------------------------------------------
/resources/ttmp32gme_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/resources/ttmp32gme_icon.png
--------------------------------------------------------------------------------
/resources/ttmp32gme_logo.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/resources/ttmp32gme_logo.pdf
--------------------------------------------------------------------------------
/resources/ttmp32gme_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/resources/ttmp32gme_logo.png
--------------------------------------------------------------------------------
/src/TTMp32Gme/Build/FileHandler.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::Build::FileHandler;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use PAR;
7 | use Path::Class;
8 | use File::Copy::Recursive qw(dirmove);
9 | use Log::Message::Simple qw(msg debug error);
10 | use Data::Dumper;
11 | use Encode qw(_utf8_off);
12 |
13 | require Exporter;
14 | our @ISA = qw(Exporter);
15 | our @EXPORT =
16 | qw(loadTemplates loadAssets openBrowser get_default_library_path checkConfigFile loadStatic makeTempAlbumDir makeNewAlbumDir moveToAlbum removeTempDir clearAlbum removeAlbum cleanup_filename remove_library_dir get_executable_path get_oid_cache get_tiptoi_dir get_gmes_already_on_tiptoi delete_gme_tiptoi move_library);
17 | my @build_imports = qw(loadFile get_local_storage get_par_tmp loadTemplates loadAssets openBrowser);
18 |
19 | if ( PAR::read_file('build.txt') ) {
20 | if ( $^O eq 'darwin' ) {
21 | require TTMp32Gme::Build::Mac;
22 | import TTMp32Gme::Build::Mac @build_imports;
23 | } elsif ( $^O =~ /MSWin/ ) {
24 | require TTMp32Gme::Build::Win;
25 | import TTMp32Gme::Build::Win @build_imports;
26 | }
27 | } else {
28 | require TTMp32Gme::Build::Perl;
29 | import TTMp32Gme::Build::Perl @build_imports;
30 | }
31 |
32 | ## private functions:
33 |
34 | sub get_unique_path {
35 | my ($path) = @_;
36 | my $count = 0;
37 | while ( -e $path ) {
38 | $path =~ s/_\d*$//;
39 | $path .= '_' . $count;
40 | $count++;
41 | }
42 | return $path;
43 | }
44 |
45 | ##public functions:
46 |
47 | sub get_default_library_path {
48 | my $library = dir( get_local_storage(), 'library' );
49 | $library->mkpath();
50 | return $library->stringify();
51 | }
52 |
53 | sub checkConfigFile {
54 | my $configdir = get_local_storage();
55 | my $configfile = file( $configdir, 'config.sqlite' );
56 | if ( !-f $configfile ) {
57 | my $cfgToCopy = file( get_par_tmp(), 'config.sqlite' );
58 | $cfgToCopy->copy_to($configfile)
59 | or die "Could not create local copy of config file '$cfgToCopy': $!";
60 | }
61 | if ( $^O =~ /MSWin/ ) {
62 | return Win32::GetShortPathName($configfile);
63 | } else {
64 | return $configfile;
65 | }
66 | }
67 |
68 | sub loadStatic {
69 | my $static = {};
70 | my @staticFiles = ( 'upload.html', 'library.html', 'config.html', 'help.html', );
71 | foreach my $file (@staticFiles) {
72 | $static->{$file} = loadFile($file);
73 | }
74 |
75 | return $static;
76 | }
77 |
78 | sub makeTempAlbumDir {
79 | my ( $temp_name, $library_path ) = @_;
80 | $library_path = $library_path ? $library_path : get_default_library_path();
81 | my $albumPath = dir( $library_path, 'temp', $temp_name );
82 | $albumPath->mkpath();
83 | return $albumPath;
84 | }
85 |
86 | sub makeNewAlbumDir {
87 | my ( $albumTitle, $library_path ) = @_;
88 | $library_path = $library_path ? $library_path : get_default_library_path();
89 |
90 | #make sure no album hogs the temp directory
91 | if ( $albumTitle eq 'temp' ) {
92 | $albumTitle .= '_0';
93 | }
94 | my $album_path =
95 | get_unique_path( ( dir( $library_path, $albumTitle ) )->stringify );
96 | $album_path = dir($album_path);
97 | $album_path->mkpath();
98 | return $album_path->stringify;
99 | }
100 |
101 | sub moveToAlbum {
102 | my ( $albumPath, $filePath ) = @_;
103 | my $file = file($filePath);
104 | my $target = get_unique_path( file( $albumPath, cleanup_filename( $file->basename() ) )->stringify );
105 | my $target_file = file($target);
106 | my $album_file = $file->move_to($target_file);
107 | return $album_file->basename();
108 | }
109 |
110 | sub removeTempDir {
111 | my ($library_path) = @_;
112 | $library_path = $library_path ? $library_path : get_default_library_path();
113 | my $tempPath = dir( $library_path, 'temp' );
114 | if ( $tempPath =~ /temp/ && -d $tempPath ) {
115 | print "deleting $tempPath\n";
116 | $tempPath->rmtree();
117 | }
118 | return 1;
119 | }
120 |
121 | sub clearAlbum {
122 | my ( $path, $file_list, $library_path ) = @_;
123 | $library_path = $library_path ? $library_path : get_default_library_path();
124 | $library_path =~ s/\\/\\\\/g; #fix windows paths
125 | if ( $path =~ /^$library_path/ ) {
126 | foreach my $file ( @{$file_list} ) {
127 | if ($file) {
128 | my $full_file = file( $path, $file );
129 | if ( -f $full_file ) {
130 | $full_file->remove();
131 | }
132 | }
133 | }
134 | return 1;
135 | } else {
136 | return 0;
137 | }
138 | }
139 |
140 | sub cleanup_filename {
141 | my $filename = $_[0];
142 | $filename =~ s/\s/_/g;
143 | $filename =~ s/[^A-Za-z0-9_\-\.]//g;
144 | $filename =~ s/\.\./\./g;
145 | $filename =~ s/\.$//g;
146 | _utf8_off($filename)
147 | ; #prevent perl from messing up filenames with non-ascii characters because of perl open() bug: https://github.com/perl/perl5/issues/15883
148 | return $filename;
149 | }
150 |
151 | sub remove_library_dir {
152 | my ( $media_path, $library_path ) = @_;
153 | $library_path = $library_path ? $library_path : get_default_library_path();
154 | my $media_dir = dir($media_path);
155 | $library_path =~ s/\\/\\\\/g; #fix windows paths
156 | if ( $media_dir =~ /^$library_path/ ) {
157 | $media_dir->rmtree();
158 | return 1;
159 | } else {
160 | return 0;
161 | }
162 | }
163 |
164 | sub get_executable_path {
165 | my $exe_name = $_[0];
166 | if ( $^O =~ /MSWin/ ) {
167 | $exe_name .= '.exe';
168 | }
169 | my $exe_path;
170 | if ( PAR::read_file('build.txt') ) {
171 | $exe_path = ( file( get_par_tmp(), 'lib', $exe_name ) )->stringify();
172 | } else {
173 | if ( $^O =~ /MSWin/ ) {
174 | $exe_path =
175 | ( file( get_par_tmp(), '..', 'lib', 'win', $exe_name ) )->stringify();
176 | } elsif ( $^O eq 'darwin' ) {
177 | $exe_path =
178 | ( file( get_par_tmp(), '..', 'lib', 'mac', $exe_name ) )->stringify();
179 | } else {
180 | $ENV{'PATH'} = $ENV{'PATH'} . ':/usr/local/bin';
181 | my $foo = `which $exe_name`;
182 | chomp($foo);
183 | $exe_path = $foo;
184 | }
185 | }
186 | if ( -x $exe_path ) {
187 | return $exe_path;
188 | } else {
189 | return "";
190 | }
191 | }
192 |
193 | sub get_oid_cache {
194 | my $oid_cache = dir( get_local_storage(), 'oid_cache' );
195 | if ( !-d $oid_cache ) {
196 | $oid_cache->mkpath();
197 | my $cache = dir( get_par_tmp(), 'oid_cache' );
198 | $cache->recurse(
199 | callback => sub {
200 | my ($file) = @_;
201 | if ( -f $file && $file =~ /\.png$/ ) {
202 | $file->copy_to( file( $oid_cache, $file->basename() ) );
203 | }
204 | }
205 | );
206 | }
207 | return $oid_cache->stringify();
208 | }
209 |
210 | sub get_tiptoi_dir {
211 | if ( $^O eq 'darwin' ) {
212 | my @tiptoi_paths =
213 | ( dir( '', 'Volumes', 'tiptoi' ), dir( '', 'Volumes', 'TIPTOI' ) );
214 | foreach my $tiptoi_path (@tiptoi_paths) {
215 | if ( -w $tiptoi_path ) {
216 | return $tiptoi_path;
217 | }
218 | }
219 | } elsif ( $^O =~ /MSWin/ ) {
220 | require Win32API::File;
221 | my @drives = Win32API::File::getLogicalDrives();
222 | foreach my $d (@drives) {
223 | my @info = (undef) x 7;
224 | Win32API::File::GetVolumeInformation( $d, @info );
225 | if ( lc $info[0] eq 'tiptoi' ) {
226 | return dir($d);
227 | }
228 | }
229 | } else {
230 | my $user = $ENV{'USER'} || "root";
231 | my @mount_points = (
232 | '/mnt/tiptoi', "/media/$user/tiptoi", '/media/removable/tiptoi', "/media/$user/TIPTOI",
233 | '/media/removable/TIPTOI'
234 | );
235 | foreach my $mount_point (@mount_points) {
236 | if ( -f "$mount_point/tiptoi.ico" ) {
237 | return dir($mount_point);
238 | }
239 | }
240 | }
241 | return 0;
242 | }
243 |
244 | sub get_gmes_already_on_tiptoi {
245 | my $tiptoi_path = get_tiptoi_dir();
246 | if ($tiptoi_path) {
247 | my @gme_list = grep( !$_->is_dir && $_->basename =~ /^(?!\._).*\.gme\z/, $tiptoi_path->children() );
248 | my %gme_names = map { $_->basename => 1 } @gme_list;
249 | return %gme_names;
250 | } else {
251 | return ();
252 | }
253 | }
254 |
255 | sub delete_gme_tiptoi {
256 | my ( $oid, $dbh, $debug ) = @_;
257 | my $album_data = $dbh->selectrow_hashref( q(SELECT gme_file FROM gme_library WHERE oid=?), {}, $oid );
258 | if ( $album_data->{'gme_file'} ) {
259 | my $gme_file = file( get_tiptoi_dir(), $album_data->{'gme_file'} );
260 | if ($debug) { debug( 'Attempting to delete: ' . $gme_file->stringify(), $debug ); }
261 | if ( $gme_file->remove() ) {
262 | msg( 'Deleted: ' . $gme_file->stringify(), \1 );
263 | return $oid;
264 | } elsif ($debug) {
265 | debug( 'Failed to delete: ' . $gme_file->stringify(), $debug );
266 | }
267 | }
268 | return 0;
269 | }
270 |
271 | sub move_library {
272 | my ( $from, $to, $dbh, $httpd, $debug ) = @_;
273 | debug( 'raw: ' . $to, $debug );
274 | my $library = dir($to);
275 | unless ( -w $library || $library->mkpath() ) {
276 | return 'error: could not write to target directory';
277 | }
278 | debug( 'mkdir: ' . $library, $debug );
279 | $library->resolve;
280 | debug( 'resolved: ' . $library, $debug );
281 | if ( $library->children() ) {
282 | return 'error: target directory not empty';
283 | }
284 | my $albums = $dbh->selectall_hashref( q( SELECT path, oid FROM gme_library ), 'oid' );
285 | my $qh = $dbh->prepare('UPDATE gme_library SET path=? WHERE oid=?');
286 | local ( $dbh->{AutoCommit} ) = 0;
287 | my $escFrom = $from;
288 | $escFrom =~ s/\\/\\\\/g;
289 | foreach my $oid ( sort keys %{$albums} ) {
290 | eval { $qh->execute( $albums->{$oid}->{'path'} =~ s/$escFrom/$library/r, $oid ); }
291 | }
292 | if ($@) {
293 | $dbh->rollback();
294 | return 'error: could not update album path in database';
295 | } else {
296 | if ( dirmove( $from, $library ) ) {
297 | $dbh->commit();
298 | return 'Success.';
299 | } else {
300 | my $errMsg = $!;
301 | $dbh->rollback();
302 | return 'error: could not move files: ' . $errMsg;
303 | }
304 | }
305 | }
306 |
307 | 1;
308 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/Build/Mac.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::Build::Mac;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Path::Class;
7 |
8 | require Exporter;
9 | our @ISA = qw(Exporter);
10 | our @EXPORT = qw(loadFile get_local_storage get_par_tmp loadTemplates loadAssets openBrowser);
11 |
12 | sub loadFile {
13 | my $path = $_[0];
14 | my $content = PAR::read_file($path);
15 | return $content;
16 | }
17 |
18 | sub get_local_storage {
19 | my $storage = dir( $ENV{'HOME'}, 'Library', 'Application Support', 'ttmp32gme' );
20 | $storage->mkpath();
21 | return $storage;
22 | }
23 |
24 | sub get_par_tmp {
25 | return dir( $ENV{'PAR_TEMP'}, 'inc' );
26 | }
27 |
28 | sub loadTemplates {
29 | my %templates = ();
30 | my $manifest = PAR::read_file('templates.list');
31 | open my $fh, '<', \$manifest;
32 | while ( my $path = <$fh> ) {
33 | $path =~ s/\R//g;
34 | my ($name) = $path =~ /.*\/(.*)\.html$/;
35 | $templates{$name} =
36 | Text::Template->new( TYPE => 'STRING', SOURCE => loadFile($path) );
37 | }
38 | return %templates;
39 | }
40 |
41 | sub loadAssets {
42 | my %assets = ();
43 | my $manifest = PAR::read_file('assets.list');
44 | open my $fh, '<', \$manifest;
45 | while ( my $path = <$fh> ) {
46 | chomp $path;
47 | my $content = loadFile($path);
48 | my $mime;
49 | if ( $path =~ /.js$/ ) {
50 | $mime = 'text/javascript';
51 | } elsif ( $path =~ /.css$/ ) {
52 | $mime = 'text/css';
53 | } else {
54 | $mime = '';
55 | }
56 | $assets{ "/" . $path } = sub {
57 | my ( $httpd, $req ) = @_;
58 |
59 | $req->respond( { content => [ $mime, $content ] } );
60 | }
61 | }
62 |
63 | return %assets;
64 | }
65 |
66 | sub openBrowser {
67 | my %config = @_;
68 | `open http://127.0.0.1:$config{'port'}/`;
69 | return 1;
70 | }
71 |
72 | 1;
73 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/Build/Perl.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::Build::Perl;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use File::Find;
7 | use Path::Class;
8 | use Cwd;
9 |
10 | require Exporter;
11 | our @ISA = qw(Exporter);
12 | our @EXPORT = qw(loadFile get_local_storage get_par_tmp loadTemplates loadAssets openBrowser);
13 |
14 | my $maindir = cwd();
15 |
16 | sub loadFile {
17 | my $path = $_[0];
18 | my $file = file($path);
19 | my $content = $file->slurp( iomode => '<:raw' );
20 | return $content;
21 | }
22 |
23 | sub get_local_storage {
24 | my $retdir;
25 | if ( defined $ENV{'APPDATA'} ) {
26 | $retdir = dir( $ENV{'APPDATA'}, 'ttmp32gme' );
27 | } elsif ( defined $ENV{'HOME'} ) {
28 | if ( $^O eq 'darwin' ) {
29 | $retdir = dir( $ENV{'HOME'}, 'Library', 'Application Support', 'ttmp32gme' );
30 | } else {
31 | $retdir = dir( $ENV{'HOME'}, '.ttmp32gme' );
32 | }
33 | } else {
34 | $retdir = dir($maindir);
35 | }
36 | $retdir->mkpath();
37 | return $retdir;
38 | }
39 |
40 | sub get_par_tmp {
41 | return dir($maindir);
42 | }
43 |
44 | sub loadTemplates {
45 | my %templates = ();
46 | find(
47 | sub {
48 | my ($name) = $File::Find::name =~ /.*\/(.*)\.html$/;
49 | $templates{$name} = Text::Template->new( TYPE => 'FILE', SOURCE => $_ )
50 | if -f;
51 | },
52 | 'templates/'
53 | );
54 | return %templates;
55 | }
56 |
57 | sub loadAssets {
58 | my %assets = ();
59 | find(
60 | sub {
61 | my $content = loadFile($_) if -f;
62 | my $mime;
63 | if ( $_ =~ /.js$/ ) {
64 | $mime = 'text/javascript';
65 | } elsif ( $_ =~ /.css$/ ) {
66 | $mime = 'text/css';
67 | } else {
68 | $mime = '';
69 | }
70 | $assets{ "/" . $File::Find::name } = sub {
71 | my ( $httpd, $req ) = @_;
72 |
73 | $req->respond( { content => [ $mime, $content ] } );
74 | }
75 | },
76 | 'assets/'
77 | );
78 | return %assets;
79 | }
80 |
81 | sub openBrowser {
82 |
83 | #Do nothing
84 | return 1;
85 | }
86 |
87 | 1;
88 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/Build/Win.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::Build::Win;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Path::Class;
7 |
8 | require Exporter;
9 | our @ISA = qw(Exporter);
10 | our @EXPORT = qw(loadFile get_local_storage get_par_tmp loadTemplates loadAssets openBrowser);
11 |
12 | sub loadFile {
13 | my $path = $_[0];
14 | my $content = PAR::read_file($path);
15 | return $content;
16 | }
17 |
18 | sub get_local_storage {
19 | my $storage = dir( $ENV{'APPDATA'}, 'ttmp32gme' );
20 | $storage->mkpath();
21 | return $storage;
22 | }
23 |
24 | sub get_par_tmp {
25 | return dir( $ENV{'PAR_TEMP'}, 'inc' );
26 | }
27 |
28 | sub loadTemplates {
29 | my %templates = ();
30 | my $manifest = PAR::read_file('templates.list');
31 | open my $fh, '<', \$manifest;
32 | while ( my $path = <$fh> ) {
33 | $path =~ s/\R//g;
34 | my ($name) = $path =~ /.*\/(.*)\.html$/;
35 | $templates{$name} =
36 | Text::Template->new( TYPE => 'STRING', SOURCE => loadFile($path) );
37 | }
38 | return %templates;
39 | }
40 |
41 | sub loadAssets {
42 | my %assets = ();
43 | my $manifest = PAR::read_file('assets.list');
44 | open my $fh, '<', \$manifest;
45 | while ( my $path = <$fh> ) {
46 | $path =~ s/\R//g;
47 | my $content = loadFile($path);
48 | my $mime;
49 | if ( $path =~ /.js$/ ) {
50 | $mime = 'text/javascript';
51 | } elsif ( $path =~ /.css$/ ) {
52 | $mime = 'text/css';
53 | } else {
54 | $mime = '';
55 | }
56 | $assets{ "/" . $path } = sub {
57 | my ( $httpd, $req ) = @_;
58 |
59 | $req->respond( { content => [ $mime, $content ] } );
60 | }
61 | }
62 |
63 | return %assets;
64 | }
65 |
66 | sub openBrowser {
67 | my %config = @_;
68 | `start http://127.0.0.1:$config{'port'}/`;
69 | return 1;
70 | }
71 |
72 | 1;
73 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/DbUpdate.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::DbUpdate;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | my $updates = {
7 | '0.1.0' => <<'END',
8 | UPDATE "config" SET value='0.1.0' WHERE param='version';
9 | END
10 | '0.2.0' => <<'END',
11 | UPDATE "config" SET value='0.2.0' WHERE param='version';
12 | END
13 | '0.2.1' => <<'END',
14 | UPDATE "config" SET value='0.2.1' WHERE param='version';
15 | END
16 | '0.2.3' => <<'END',
17 | UPDATE "config" SET value='0.2.3' WHERE param='version';
18 | INSERT INTO "config" ("param", "value") VALUES ('pen_language', 'GERMAN');
19 | END
20 | '0.3.0' => <<'END',
21 | UPDATE "config" SET value='0.3.0' WHERE param='version';
22 | INSERT INTO "config" ("param", "value") VALUES ('library_path', '');
23 | INSERT INTO "config" ("param", "value") VALUES ('player_mode', 'music');
24 | END
25 | '0.3.1' => <<'END',
26 | UPDATE "config" SET value='0.3.1' WHERE param='version';
27 | DELETE FROM "config" WHERE param='player_mode';
28 | ALTER TABLE "gme_library" ADD COLUMN "player_mode" TEXT DEFAULT 'music';
29 | END
30 | '1.0.0' => <<'END',
31 | UPDATE "config" SET value='1.0.0' WHERE param='version';
32 | END
33 | };
34 |
35 | sub update {
36 | my ( $dbVersion, $dbh ) = @_;
37 |
38 | foreach my $u ( sort keys %{$updates} ) {
39 | if ( Perl::Version->new($u)->numify > $dbVersion->numify ) {
40 | my $batch = DBIx::MultiStatementDo->new( dbh => $dbh );
41 | $batch->do( $updates->{$u} )
42 | or die "Can't update config file.\n\tError: " . $batch->dbh->errstr . "\n";
43 | }
44 | }
45 |
46 | return 1;
47 | }
48 |
49 | 1;
50 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/LibraryHandler.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::LibraryHandler;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Path::Class;
7 | use List::MoreUtils qw(uniq);
8 | use Cwd;
9 | use Data::Dumper;
10 | use Encode qw(encode encode_utf8);
11 |
12 | use Image::Info qw(image_type);
13 | use Music::Tag ( traditional => 1 );
14 | use Music::Tag::Auto;
15 | use Music::Tag::MusicBrainz;
16 | use Music::Tag::MP3;
17 | use Music::Tag::OGG;
18 | use MP3::Tag;
19 |
20 | #use Music::Tag:Amazon; #needs developer key
21 | #use Music::Tag:LyricsFetcher; #maybe use this in a future release?
22 |
23 | use Log::Message::Simple qw(msg debug error);
24 |
25 | use TTMp32Gme::Build::FileHandler;
26 |
27 | require Exporter;
28 | our @ISA = qw(Exporter);
29 | our @EXPORT =
30 | qw(updateTableEntry put_file_online createLibraryEntry get_album_list get_album get_album_online updateAlbum deleteAlbum cleanupAlbum replace_cover);
31 |
32 | ## private methods
33 |
34 | sub oid_exist {
35 | my ( $oid, $dbh ) = @_;
36 | my @old_oids = map { @$_ } @{ $dbh->selectall_arrayref('SELECT oid FROM gme_library ORDER BY oid') };
37 | if ( grep( /^$oid$/, @old_oids ) ) {
38 | return 1;
39 | } else {
40 | return 0;
41 | }
42 | }
43 |
44 | sub newOID {
45 | my $dbh = $_[0];
46 | my $oid;
47 | my @old_oids =
48 | map { @$_ } @{ $dbh->selectall_arrayref('SELECT oid FROM gme_library ORDER BY oid DESC') };
49 | if (@old_oids) {
50 | if ( $old_oids[0] < 999 ) {
51 |
52 | #if we have free oids above the highest used oid, then use those
53 | $oid = $old_oids[0] + 1;
54 | } else {
55 |
56 | #if oid 999 is already in the database,
57 | #then look for oids freed by deleting old ones
58 | my %oid_test = map { $_ => 1 } @old_oids;
59 | my $new_oid = $old_oids[-1] + 1;
60 | while ( ( $new_oid < 1001 ) and ( $oid_test{$new_oid} ) ) {
61 | $new_oid++;
62 | }
63 | if ( $new_oid == 1000 ) {
64 |
65 | #we still have not found a free oid,
66 | #look for free oids below the default oid
67 | $new_oid = $old_oids[-1] - 1;
68 | while ( $new_oid gt 0 and $oid_test{$new_oid} ) {
69 | $new_oid -= 1;
70 | }
71 | if ( $new_oid > 1 ) {
72 | $oid = $new_oid;
73 | } else {
74 | error( 'could not find a free oid.' . ' Try deleting oids from your library.', 1 );
75 | }
76 | } else {
77 | $oid = $new_oid;
78 | }
79 | }
80 | } else {
81 | $oid = 920;
82 | }
83 | return $oid;
84 | }
85 |
86 | sub writeToDatabase {
87 | my ( $table, $data, $dbh ) = @_;
88 | my @fields = sort keys %$data;
89 | my @values = @{$data}{@fields};
90 | my $query =
91 | sprintf( "INSERT INTO $table (%s) VALUES (%s)", join( ", ", @fields ), join( ", ", map { '?' } @values ) );
92 | my $qh = $dbh->prepare($query);
93 | $qh->execute(@values);
94 | }
95 |
96 | sub get_tracks {
97 | my ( $album, $dbh ) = @_;
98 | my $query = "SELECT * FROM tracks WHERE parent_oid=$album->{'oid'} ORDER BY track";
99 | my $tracks = $dbh->selectall_hashref( $query, 'track' );
100 | foreach my $track ( sort keys %{$tracks} ) {
101 | $album->{ 'track_' . $track } = $tracks->{$track};
102 | }
103 | return $album;
104 | }
105 |
106 | sub put_cover_online {
107 | my ( $album, $httpd ) = @_;
108 | if ( $album->{'picture_filename'} ) {
109 | my $picture_file = file( $album->{'path'}, $album->{'picture_filename'} );
110 | my $online_path = '/assets/images/' . $album->{'oid'} . '/' . $album->{'picture_filename'};
111 | put_file_online( $picture_file, $online_path, $httpd );
112 | return 1;
113 | } else {
114 | return 0;
115 | }
116 | }
117 |
118 | sub switchTracks {
119 | my ( $oid, $new_tracks, $dbh ) = @_;
120 | my $query = "SELECT * FROM tracks WHERE parent_oid=$oid ORDER BY track";
121 | my $tracks = $dbh->selectall_hashref( $query, 'track' );
122 | $dbh->do("DELETE FROM tracks WHERE parent_oid=$oid");
123 | foreach my $track ( sort keys %{$new_tracks} ) {
124 | $tracks->{$track}{'track'} = $new_tracks->{$track};
125 | writeToDatabase( 'tracks', $tracks->{$track}, $dbh );
126 | }
127 | }
128 |
129 | sub sortByDiscTrackFilename {
130 | no warnings 'uninitialized';
131 | $a->{'disc'} <=> $b->{'disc'} or $a->{'track'} <=> $b->{'track'} or $a->{'filename'} cmp $b->{'filename'};
132 | }
133 |
134 | sub sortTracks {
135 | my ($track_data) = @_;
136 | my @tracks = map( $_->{'track'}, @{$track_data} );
137 | my @sorted_track_data = sort sortByDiscTrackFilename @{$track_data};
138 | foreach my $track_no ( 0 .. $#sorted_track_data ) {
139 | $sorted_track_data[$track_no]->{'track'} = $track_no + 1;
140 | }
141 | return @sorted_track_data;
142 | }
143 |
144 | sub get_cover_filename {
145 | my ( $mimetype, $pictureData ) = @_;
146 | if ( defined $mimetype && $mimetype =~ /^image/i ) {
147 | $mimetype =~ s/.*\///;
148 | return 'cover.' . $mimetype;
149 | } elsif ($pictureData) {
150 | my $imgType = image_type( \$pictureData );
151 | return 'cover.' . $imgType;
152 | }
153 | return 0;
154 | }
155 |
156 | ## public methods:
157 |
158 | sub updateTableEntry {
159 | my ( $table, $keyname, $search_keys, $data, $dbh ) = @_;
160 | my @fields = sort keys %$data;
161 | my @values = @{$data}{@fields};
162 | my $qh = $dbh->prepare( sprintf( 'UPDATE %s SET %s=? WHERE %s', $table, join( "=?, ", @fields ), $keyname ) );
163 | push( @values, @{$search_keys} );
164 | if ( $^O =~ /MSWin/ ) {
165 | @values = map { encode( "cp" . Win32::GetACP(), $_ ) } @values; #fix encoding problems on windows
166 | } else {
167 | @values = map { encode_utf8($_) } @values; #fix encoding problems on mac
168 | }
169 | $qh->execute(@values);
170 | return !$dbh->errstr;
171 | }
172 |
173 | sub put_file_online {
174 | my ( $file, $online_path, $httpd ) = @_;
175 | delete $httpd->{__oe_events}->{$online_path};
176 | $httpd->reg_cb(
177 | $online_path => sub {
178 | my $file_data = $file->slurp( iomode => '<:raw' );
179 | my ( $httpd, $req ) = @_;
180 | $req->respond( { content => [ '', $file_data ] } );
181 | }
182 | );
183 | return 1;
184 | }
185 |
186 | sub createLibraryEntry {
187 | my ( $albumList, $dbh, $library_path, $debug ) = @_;
188 | foreach my $album ( @{$albumList} ) {
189 | if ($album) {
190 | my $oid = newOID($dbh);
191 | my %album_data;
192 | my @track_data;
193 | my $pictureData;
194 | my $trackNo = 1;
195 | foreach my $fileId ( sort keys %{$album} ) {
196 | if ( $album->{$fileId} =~ /\.(mp3|ogg)$/i ) {
197 | if ($debug) { debug( "Parsing audio file: $album->{$fileId}", $debug ); }
198 |
199 | #handle mp3 and ogg audio files
200 | my $info = Music::Tag->new( $album->{$fileId} );
201 | $info->get_tag( $album->{$fileId} );
202 |
203 | #if ($debug) {print 'Music::Tag::get_tag returned:' . Dumper($info);}
204 |
205 | #fill in album info
206 | if ( !$album_data{'album_title'} && $info->album() ) {
207 | if ( $^O =~ /MSWin/ ) {
208 | $album_data{'album_title'} = encode( "cp" . Win32::GetACP(), $info->album() );
209 | } else {
210 | $album_data{'album_title'} = $info->album();
211 | }
212 | $album_data{'path'} = cleanup_filename( $album_data{'album_title'} );
213 | }
214 | if ( !$album_data{'album_artist'} && $info->albumartist() ) {
215 | $album_data{'album_artist'} = $info->albumartist();
216 | } elsif ( !$album_data{'album_artist'} && $info->artist() ) {
217 | $album_data{'album_artist'} = $info->artist();
218 | }
219 | if ( $^O =~ /MSWin/ ) {
220 | $album_data{'album_artist'} = encode( "cp" . Win32::GetACP(), $album_data{'album_artist'} );
221 | }
222 | if ( !$album_data{'album_year'} && $info->year() ) {
223 | $album_data{'album_year'} = $info->get_year();
224 | }
225 | if ( !$album_data{'picture_filename'} && $info->picture_exists() ) {
226 | if ( $info->picture_filename() ) {
227 | $album_data{'picture_filename'} = cleanup_filename( $info->picture_filename() );
228 | } elsif ( $info->picture() ) {
229 | my $pic = $info->picture();
230 | $pictureData = $$pic{'_Data'};
231 | my $mimetype = $$pic{'MIME type'};
232 | $album_data{'picture_filename'} = get_cover_filename( $mimetype, $pictureData );
233 | }
234 | } elsif ( !$album_data{'picture_filename'}
235 | && !$info->picture_exists()
236 | && $album->{$fileId} =~ /\.mp3$/i )
237 | {
238 | #Music::Tag::MP3 is not always reliable when extracting the picture,
239 | #try to use MP3::Tag directly.
240 | my $mp3 = MP3::Tag->new( $album->{$fileId} );
241 | $mp3->get_tags();
242 |
243 | debug( Dumper($mp3), $debug > 2 );
244 | my $id3v2_tagdata = $mp3->{ID3v2};
245 | if ($id3v2_tagdata) {
246 | my $apic = $id3v2_tagdata->get_frame("APIC");
247 | $pictureData = $$apic{'_Data'};
248 | my $mimetype = $$apic{'MIME type'};
249 | $album_data{'picture_filename'} = get_cover_filename( $mimetype, $pictureData );
250 | }
251 | }
252 |
253 | #fill in track info
254 | my %trackInfo = (
255 | 'parent_oid' => $oid,
256 | 'album' => $info->album(),
257 | 'artist' => $info->artist(),
258 | 'disc' => $info->disc(),
259 | 'duration' => $info->duration(),
260 | 'genre' => $info->genre(),
261 | 'lyrics' => $info->lyrics(),
262 | 'title' => $info->title(),
263 | 'track' => $info->track(),
264 | 'filename' => $album->{$fileId},
265 | );
266 | if ( !$trackInfo{'track'} ) {
267 | $trackInfo{'track'} = $trackNo;
268 | $trackNo++;
269 | $trackInfo{'title'} = cleanup_filename( ( file( $album->{$fileId} ) )->basename() );
270 | error(
271 | "WARNING: id3 tag missing or incomplete for $album->{$fileId}.\nPlease add an id3v2 tag containing at least album, title and track number to your mp3 file in order to get proper album and track info."
272 | );
273 | }
274 | if ( $^O =~ /MSWin/ ) {
275 | foreach my $key ( keys %trackInfo ) {
276 | $trackInfo{$key} = encode( "cp" . Win32::GetACP(), $trackInfo{$key} );
277 | }
278 | }
279 | push( @track_data, \%trackInfo );
280 | } elsif ( $album->{$fileId} =~ /\.(jpg|jpeg|tif|tiff|png|gif)$/i ) {
281 | if ($debug) { debug( "Parsing cover image: $album->{$fileId}", $debug ); }
282 |
283 | #handle pictures
284 | my $picture_file = file( $album->{$fileId} );
285 | $pictureData = $picture_file->slurp( iomode => '<:raw' );
286 | $album_data{'picture_filename'} = cleanup_filename( $picture_file->basename() );
287 | }
288 | }
289 | $album_data{'oid'} = $oid;
290 | $album_data{'num_tracks'} = scalar(@track_data);
291 | if ( !$album_data{'album_title'} ) {
292 | $album_data{'path'} = 'unknown';
293 | $album_data{'album_title'} = $album_data{'path'};
294 | }
295 | $album_data{'path'} = makeNewAlbumDir( $album_data{'path'}, $library_path );
296 | if ( $album_data{'picture_filename'} and $pictureData ) {
297 | my $picture_file =
298 | file( $album_data{'path'}, $album_data{'picture_filename'} );
299 | $picture_file->spew( iomode => '>:raw', $pictureData );
300 | }
301 | @track_data = sortTracks( \@track_data );
302 | foreach my $track (@track_data) {
303 | $track->{'filename'} =
304 | moveToAlbum( $album_data{'path'}, $track->{'filename'} );
305 | writeToDatabase( 'tracks', $track, $dbh );
306 | }
307 | writeToDatabase( 'gme_library', \%album_data, $dbh );
308 | if ($debug) {
309 | debug( "Found the following album info:\n", $debug > 1 );
310 | debug( Dumper( \%album_data ), $debug > 1 );
311 | debug( "\nFound the following track info:\n", $debug > 2 );
312 | debug( Dumper( \@track_data ), $debug > 2 );
313 | }
314 | }
315 | }
316 | removeTempDir($library_path);
317 | }
318 |
319 | sub get_album_list {
320 | my ( $dbh, $httpd, $debug ) = @_;
321 | my @albumList;
322 | my $albums = $dbh->selectall_hashref( q( SELECT * FROM gme_library ORDER BY oid DESC ), 'oid' );
323 | debug( Dumper($albums), $debug > 2 );
324 | my %gmes_on_tiptoi = get_gmes_already_on_tiptoi();
325 | debug( 'Found gme files on tiptoi: ' . Dumper( \%gmes_on_tiptoi ), $debug > 1 );
326 | foreach my $oid ( sort keys %{$albums} ) {
327 | $albums->{$oid} = get_tracks( $albums->{$oid}, $dbh );
328 | if ( $albums->{$oid}->{'gme_file'} ) {
329 | $albums->{$oid}->{'gme_on_tiptoi'} = exists( $gmes_on_tiptoi{ $albums->{$oid}->{'gme_file'} } );
330 | } else {
331 | $albums->{$oid}->{'gme_on_tiptoi'} = 0;
332 | }
333 | put_cover_online( $albums->{$oid}, $httpd );
334 | push( @albumList, $albums->{$oid} );
335 | }
336 | return \@albumList;
337 | }
338 |
339 | sub get_album {
340 | my ( $oid, $dbh ) = @_;
341 | my $album = $dbh->selectrow_hashref( q( SELECT * FROM gme_library WHERE oid=? ), {}, $oid );
342 | $album = get_tracks( $album, $dbh );
343 | return $album;
344 | }
345 |
346 | sub get_album_online {
347 | my ( $oid, $httpd, $dbh ) = @_;
348 | if ($oid) {
349 | my $album = get_album( $oid, $dbh );
350 | if ( defined $album->{'gme_file'} ) {
351 | my %gmes_on_tiptoi = get_gmes_already_on_tiptoi();
352 | $album->{'gme_on_tiptoi'} = exists( $gmes_on_tiptoi{ $album->{'gme_file'} } );
353 | } else {
354 | $album->{'gme_on_tiptoi'} = \0;
355 | }
356 | put_cover_online( $album, $httpd );
357 | return $album;
358 | }
359 | return 0;
360 | }
361 |
362 | sub updateAlbum {
363 | my ( $postData, $dbh, $debug ) = @_;
364 | my $old_oid = $postData->{'old_oid'};
365 | delete( $postData->{'old_oid'} );
366 | debug("Old OID: $old_oid; new OID: $postData->{'oid'}", $debug > 0);
367 | debug(Dumper($postData), $debug > 1);
368 | if ( $old_oid != $postData->{'oid'} ) {
369 | if ( oid_exist( $postData->{'oid'}, $dbh ) ) {
370 | return 0;
371 | $dbh->set_err( '', 'Could not update album, oid already exists. Try a different oid.' );
372 | } else {
373 | for my $track ( grep /^track_/, keys %{$postData} ) {
374 | $postData->{$track}{'parent_oid'} = $postData->{'oid'};
375 | }
376 | }
377 | }
378 | my %new_tracks;
379 | for my $track ( sort grep /^track_/, keys %{$postData} ) {
380 | my $old_track = $track;
381 | $old_track =~ s/^track_//;
382 | $new_tracks{$old_track} = $postData->{$track}{'track'};
383 | delete( $postData->{$track}{'track'} );
384 | my %track_data = %{ $postData->{$track} };
385 | my @selectors = ( $old_oid, $old_track );
386 | updateTableEntry( 'tracks', 'parent_oid=? and track=?', \@selectors, \%track_data, $dbh );
387 | delete( $postData->{$track} );
388 | }
389 | switchTracks( $postData->{'oid'}, \%new_tracks, $dbh );
390 | my @selector = ($old_oid);
391 | updateTableEntry( 'gme_library', 'oid=?', \@selector, $postData, $dbh );
392 | return $postData->{'oid'};
393 | }
394 |
395 | sub deleteAlbum {
396 | my ( $oid, $httpd, $dbh, $library_path ) = @_;
397 | my $album_data = $dbh->selectrow_hashref( q(SELECT path,picture_filename FROM gme_library WHERE oid=?), {}, $oid );
398 | if ( $album_data->{'picture_filename'} ) {
399 | delete $httpd->{__oe_events}->{ '/assets/images/' . $oid . '/' . $album_data->{'picture_filename'} };
400 | }
401 | if ( remove_library_dir( $album_data->{'path'}, $library_path ) ) {
402 | $dbh->do( q(DELETE FROM tracks WHERE parent_oid=?), {}, $oid );
403 | $dbh->do( q( DELETE FROM gme_library WHERE oid=? ), {}, $oid );
404 | }
405 | return $oid;
406 | }
407 |
408 | sub cleanupAlbum {
409 | my ( $oid, $httpd, $dbh, $library_path ) = @_;
410 | my $album_data = $dbh->selectrow_hashref( q(SELECT path,picture_filename FROM gme_library WHERE oid=?), {}, $oid );
411 | my $query = q(SELECT filename FROM tracks WHERE parent_oid=? ORDER BY track);
412 | my @file_list =
413 | map { @$_ } @{ $dbh->selectall_arrayref( $query, {}, $oid ) };
414 | my $data = { 'filename' => undef };
415 | if ( clearAlbum( $album_data->{'path'}, \@file_list, $library_path ) ) {
416 | updateTableEntry( 'tracks', 'parent_oid=?', [$oid], $data, $dbh );
417 | }
418 | return $oid;
419 | }
420 |
421 | sub replace_cover {
422 | my ( $oid, $filename, $file_data, $httpd, $dbh ) = @_;
423 | if ( $filename && $file_data ) {
424 | my $album_data = $dbh->selectrow_hashref( q(SELECT path,picture_filename FROM gme_library WHERE oid=?), {}, $oid );
425 | if ( $album_data->{'picture_filename'} ) {
426 | delete $httpd->{__oe_events}->{ '/assets/images/' . $oid . '/' . $album_data->{'picture_filename'} };
427 | file( $album_data->{'path'}, $album_data->{'picture_filename'} )->remove();
428 | if ( $filename eq $album_data->{'picture_filename'} ) {
429 |
430 | #hack to make sure the cover is refreshed properly despite browser caching.
431 | $filename = "0_$filename";
432 | }
433 | }
434 | my @selector = ($oid);
435 | $album_data->{'picture_filename'} = $filename;
436 | updateTableEntry( 'gme_library', 'oid=?', \@selector, $album_data, $dbh );
437 | my $picture_file =
438 | file( $album_data->{'path'}, $album_data->{'picture_filename'} );
439 | $picture_file->spew( iomode => '>:raw', $file_data );
440 | return $oid;
441 | } else {
442 | return 0;
443 | }
444 | }
445 |
446 | 1;
447 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/PrintHandler.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::PrintHandler;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Path::Class;
7 | use Cwd;
8 |
9 | use Log::Message::Simple qw(msg debug error);
10 |
11 | use TTMp32Gme::Build::FileHandler;
12 | use TTMp32Gme::LibraryHandler;
13 | use TTMp32Gme::TttoolHandler;
14 |
15 | require Exporter;
16 | our @ISA = qw(Exporter);
17 | our @EXPORT = qw(create_print_layout create_pdf format_print_button);
18 |
19 | ## internal functions:
20 |
21 | sub format_tracks {
22 | my ( $album, $oid_map, $httpd, $dbh ) = @_;
23 | my $content;
24 | my @tracks = get_sorted_tracks($album);
25 | foreach my $i ( 0 .. $#tracks ) {
26 | my @oid = ( $oid_map->{ $album->{ $tracks[$i] }{'tt_script'} }{'code'} );
27 |
28 | #6 mm equals 34.015748031 pixels at 144 dpi
29 | #(apparently chromium uses 144 dpi on my macbook pro)
30 | my $oid_file = @{ create_oids( \@oid, 24, $dbh ) }[0];
31 | my $oid_path = '/assets/images/' . $oid_file->basename();
32 | put_file_online( $oid_file, $oid_path, $httpd );
33 | $content .= "";
34 | $content .=
35 | " ";
36 | $content .= sprintf(
37 | "%d. %s (%02d:%02d )
\n",
38 | $i + 1,
39 | $album->{ $tracks[$i] }{'title'},
40 | $album->{ $tracks[$i] }{'duration'} / 60000,
41 | $album->{ $tracks[$i] }{'duration'} / 1000 % 60
42 | );
43 | }
44 | return $content;
45 | }
46 |
47 | sub format_controls {
48 | my ( $oid_map, $httpd, $dbh ) = @_;
49 | my @oids =
50 | ( $oid_map->{'prev'}{'code'}, $oid_map->{'play'}{'code'}, $oid_map->{'stop'}{'code'}, $oid_map->{'next'}{'code'} );
51 | my @icons = ( 'backward', 'play', 'stop', 'forward' );
52 | my $files = create_oids( \@oids, 24, $dbh );
53 | my $template =
54 | ' '
55 | . ' ';
56 | my $content;
57 | foreach my $i ( 0 .. $#oids ) {
58 | my $oid_file = $files->[$i];
59 | my $oid_path = '/assets/images/' . $oid_file->basename();
60 | put_file_online( $oid_file, $oid_path, $httpd );
61 | $content .= sprintf( $template, $oid_path, $oids[$i], $icons[$i] );
62 | }
63 | return $content;
64 | }
65 |
66 | sub format_track_control {
67 | my ( $track_no, $oid_map, $httpd, $dbh ) = @_;
68 | my @oids = ( $oid_map->{ 't' . ( $track_no - 1 ) }{'code'} );
69 | my $files = create_oids( \@oids, 24, $dbh );
70 | my $template =
71 | '' . ' %d ';
72 | my $oid_path = '/assets/images/' . $files->[0]->basename();
73 | put_file_online( $files->[0], $oid_path, $httpd );
74 | return sprintf( $template, $oid_path, $oids[0], $track_no );
75 | }
76 |
77 | sub format_main_oid {
78 | my ( $oid, $oid_map, $httpd, $dbh ) = @_;
79 | my @oids = ($oid);
80 | my $files = create_oids( \@oids, 24, $dbh );
81 | my $oid_path = '/assets/images/' . $files->[0]->basename();
82 | put_file_online( $files->[0], $oid_path, $httpd );
83 | return " ";
84 | }
85 |
86 | sub format_cover {
87 | my ($album) = @_;
88 | if ( $album->{'picture_filename'} ) {
89 | return
90 | ' ';
94 | } else {
95 | return '';
96 | }
97 | }
98 |
99 | ## external functions:
100 |
101 | sub create_print_layout {
102 | my ( $oids, $template, $config, $httpd, $dbh ) = @_;
103 | my $content;
104 | my $oid_map = $dbh->selectall_hashref( "SELECT * FROM script_codes", 'script' );
105 | my $controls = format_controls( $oid_map, $httpd, $dbh );
106 | foreach my $oid ( @{$oids} ) {
107 | if ($oid) {
108 | my $album = get_album_online( $oid, $httpd, $dbh );
109 | if ( !$album->{'gme_file'} ) {
110 | $album = get_album_online( make_gme( $oid, $config, $dbh ), $httpd, $dbh );
111 | $oid_map = $dbh->selectall_hashref( "SELECT * FROM script_codes", 'script' );
112 |
113 | }
114 | $album->{'track_list'} = format_tracks( $album, $oid_map, $httpd, $dbh );
115 | $album->{'play_controls'} = $controls;
116 | $album->{'main_oid_image'} = format_main_oid( $oid, $oid_map, $httpd, $dbh );
117 | $album->{'formatted_cover'} = format_cover($album);
118 | $content .= $template->fill_in( HASH => $album );
119 | }
120 | }
121 |
122 | #add general controls:
123 | $content .= '';
124 | $content .= '
';
125 | $content .= "
$controls
";
126 | $content .= '
';
127 |
128 | #add general track controls
129 | $content .= '
';
130 | $content .= '
';
131 | my $counter = 1;
132 | while ( $counter <= $config->{'print_max_track_controls'} ) {
133 | $content .= format_track_control( $counter, $oid_map, $httpd, $dbh );
134 | if ( ( $counter < $config->{'print_max_track_controls'} )
135 | && ( ( $counter % 12 ) == 0 ) )
136 | {
137 | $content .= '
';
138 | $content .= '
';
139 | $content .= '
';
140 | }
141 | $counter++;
142 | }
143 | $content .= '
';
144 | return $content;
145 | }
146 |
147 | sub create_pdf {
148 | my ( $port, $library_path ) = @_;
149 | my $wkhtmltopdf_command = get_executable_path('wkhtmltopdf');
150 | $library_path = $library_path ? $library_path : get_default_library_path();
151 | if ($wkhtmltopdf_command) {
152 | my $pdf_file = file( $library_path, 'print.pdf' );
153 | my $args = "-B 0.5in -T 0.5in -L 0.5in -R 0.5in http://localhost:$port/pdf \"$pdf_file\"";
154 | my $fullCmd = "$wkhtmltopdf_command $args";
155 | print "$fullCmd\n";
156 | if ( $^O =~ /MSWin/ ) {
157 | my $child_pid;
158 | my $child_proc;
159 | require Win32::Process;
160 | Win32::Process::Create( $child_proc, $wkhtmltopdf_command, $fullCmd, 0, 0, "." )
161 | || error "Could not spawn child: $!";
162 | $child_pid = $child_proc->GetProcessID();
163 | } else {
164 | $fullCmd .= ' &';
165 | system($fullCmd);
166 | }
167 | return $pdf_file;
168 | } else {
169 | error("Could not create pdf, wkhtml2pdf not found.");
170 | return 0;
171 | }
172 | }
173 |
174 | sub format_print_button {
175 | my $button;
176 | if ( $^O =~ /MSWin/ ) {
177 | $button =
178 | 'Save as PDF ';
179 | } else {
180 | my $wkhtmltopdf_command = get_executable_path('wkhtmltopdf');
181 | if ($wkhtmltopdf_command) {
182 | my $wkhtmltopdf_version = `$wkhtmltopdf_command -V`;
183 | if ( $wkhtmltopdf_version =~ /0\.13\./ ) {
184 | $button =
185 | 'Print This Page Save as PDF ';
186 | } else {
187 | $button =
188 | 'Print This Page ';
189 | }
190 | } else {
191 | $button =
192 | 'Print This Page ';
193 | }
194 | }
195 | return $button;
196 | }
197 |
198 | 1;
199 |
--------------------------------------------------------------------------------
/src/TTMp32Gme/TttoolHandler.pm:
--------------------------------------------------------------------------------
1 | package TTMp32Gme::TttoolHandler;
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Path::Class;
7 | use Cwd;
8 |
9 | use Log::Message::Simple qw(msg error);
10 |
11 | use TTMp32Gme::Build::FileHandler;
12 | use TTMp32Gme::LibraryHandler;
13 |
14 | require Exporter;
15 | our @ISA = qw(Exporter);
16 | our @EXPORT = qw(get_sorted_tracks make_gme generate_oid_images create_oids copy_gme);
17 |
18 | ## internal functions:
19 |
20 | sub generate_codes_yaml {
21 | my ( $yaml_file, $dbh ) = @_;
22 | my $fh = $yaml_file->openr();
23 |
24 | #first seek to the scripts section
25 | while ( my $row = <$fh> ) {
26 | if ( $row =~ /scripts:/ ) {
27 | last;
28 | }
29 | }
30 | my @scripts;
31 | while ( my $row = <$fh> ) {
32 | $row =~ s/\s*(.*)\R/$1/g;
33 | if ( $row =~ /:$/ ) {
34 | $row =~ s/://;
35 | push( @scripts, $row );
36 | }
37 | }
38 | close($fh);
39 | my $query = "SELECT * FROM script_codes";
40 | my $codes = $dbh->selectall_hashref( $query, 'script' );
41 |
42 | my @sorted_codes;
43 | foreach my $script ( keys %{$codes} ) {
44 | push( @sorted_codes, $codes->{$script}{'code'} );
45 | }
46 |
47 | @sorted_codes = sort { $b <=> $a } @sorted_codes;
48 | my $last_code = $sorted_codes[0];
49 |
50 | my $filename = $yaml_file->basename();
51 | $filename =~ s/yaml$/codes.yaml/;
52 | my $codes_file = file( $yaml_file->dir(), $filename );
53 | $fh = $codes_file->openw();
54 | print $fh '# This file contains a mapping from script names to oid codes.
55 | # This way the existing scripts are always assigned to the the
56 | # same codes, even if you add further scripts.
57 | #
58 | # You can copy the contents of this file into the main .yaml file,
59 | # if you want to have both together.
60 | #
61 | # If you delete this file, the next run of "ttool assemble" might
62 | # use different codes for your scripts, and you might have to re-
63 | # create the images for your product.
64 | scriptcodes:
65 | ';
66 | foreach my $script (@scripts) {
67 | if ( $codes->{$script}{'code'} ) {
68 | print $fh " $script: $codes->{$script}{'code'}\n";
69 | } else {
70 | $last_code++;
71 | if ( $last_code > 14999 ) {
72 | my %code_test = map { $_ => 1 } @sorted_codes;
73 | $last_code = 1001;
74 | while ( $code_test{$last_code} ) {
75 | $last_code++;
76 | }
77 | if ( $last_code > 14999 ) {
78 | die("Cannot create script. All script codes are used up.");
79 | }
80 | }
81 | my $qh = $dbh->prepare(q(INSERT INTO script_codes VALUES (?,?) ));
82 | $qh->execute( ( $script, $last_code ) );
83 | unshift( @sorted_codes, $last_code );
84 | $codes->{$script}{'code'} = $last_code;
85 | print $fh " $script: $last_code\n";
86 | }
87 | }
88 | close($fh);
89 | return $codes_file;
90 | }
91 |
92 | sub convert_tracks {
93 | my ( $album, $yaml_file, $config, $dbh ) = @_;
94 | my $media_path = dir( $album->{'path'}, "audio" );
95 | my @tracks = get_sorted_tracks($album);
96 |
97 | $media_path->mkpath();
98 | if ( $config->{'audio_format'} eq 'ogg' ) {
99 | my $ff_command = get_executable_path('ffmpeg');
100 | foreach my $i ( 0 .. $#tracks ) {
101 | my $source_file =
102 | file( $album->{'path'}, $album->{ $tracks[$i] }->{'filename'} );
103 | my $target_file = file( $media_path, "track_$i.ogg" );
104 | `$ff_command -y -i "$source_file" -map 0:a -ar 22050 -ac 1 "$target_file"`;
105 | }
106 | } else {
107 | foreach my $i ( 0 .. $#tracks ) {
108 | file( $album->{'path'}, $album->{ $tracks[$i] }->{'filename'} )->copy_to( file( $media_path, "track_$i.mp3" ) );
109 | }
110 | }
111 | my $next = " next:\n";
112 | my $prev = " prev:\n";
113 | my $play = " play:\n";
114 | my $track_scripts;
115 |
116 | foreach my $i ( 0 .. $#tracks ) {
117 | if ( $i < $#tracks ) {
118 | $play .= " - \$current==$i? P(@{[$i]})";
119 | $play .= $album->{'player_mode'} eq 'tiptoi' ? " C\n" : " J(t@{[$i+1]})\n";
120 | if ( $i < $#tracks - 1 ) {
121 | $next .= " - \$current==$i? \$current:=@{[$i+1]} P(@{[$i+1]})";
122 | $next .= $album->{'player_mode'} eq 'tiptoi' ? " C\n" : " J(t@{[$i+2]})\n";
123 | } else {
124 | $next .= " - \$current==$i? \$current:=@{[$i+1]} P(@{[$i+1]}) C\n";
125 | }
126 | } else {
127 | $play .= " - \$current==$i? P(@{[$i]}) C\n";
128 | }
129 | if ( $i > 0 ) {
130 | $prev .= " - \$current==$i? \$current:=@{[$i-1]} P(@{[$i-1]})";
131 | $prev .= $album->{'player_mode'} eq 'tiptoi' ? " C\n" : " J(t@{[$i]})\n";
132 | }
133 | if ( $i < $#tracks ) {
134 | $track_scripts .= " t$i:\n - \$current:=$i P($i)";
135 | $track_scripts .= $album->{'player_mode'} eq 'tiptoi' ? " C\n" : " J(t@{[$i+1]})\n";
136 | } else {
137 | $track_scripts .= " t$i:\n - \$current:=$i P($i) C\n";
138 | }
139 | my %data = ( 'tt_script' => "t$i" );
140 | my @selectors = ( $album->{ $tracks[$i] }->{'parent_oid'}, $album->{ $tracks[$i] }->{'track'} );
141 | updateTableEntry( 'tracks', 'parent_oid=? and track=?', \@selectors, \%data, $dbh );
142 | }
143 | my $lastTrack = $#tracks;
144 | if ( scalar @tracks < $config->{'print_max_track_controls'} ) {
145 |
146 | #in case we use general track controls, we just play the last available
147 | #track if the user selects a track number that does not exist in this album.
148 | foreach my $i ( scalar @tracks .. $config->{'print_max_track_controls'} - 1 ) {
149 | $track_scripts .= " t$i:\n - \$current:=$lastTrack P($lastTrack) C\n";
150 | }
151 | }
152 | my $welcome;
153 | if ( $#tracks == 0 ) {
154 |
155 | #if there is only one track, the next and prev buttons just play that track.
156 | $next .= " - \$current:=$lastTrack P($lastTrack) C\n";
157 | $prev .= " - \$current:=$lastTrack P($lastTrack) C\n";
158 | $play .= " - \$current:=$lastTrack P($lastTrack) C\n";
159 | $welcome = "welcome: " . "'$lastTrack'" . "\n";
160 | } else {
161 | $welcome =
162 | $album->{'player_mode'} eq 'tiptoi'
163 | ? "welcome: " . "'0'" . "\n"
164 | : "welcome: " . join( ', ', ( 0 .. $#tracks ) ) . "\n";
165 |
166 | }
167 |
168 | # add track code to the yaml file:
169 | my $fh = $yaml_file->opena();
170 |
171 | print $fh "media-path: audio/track_%s\n";
172 | print $fh "init: \$current:=0\n";
173 | print $fh $welcome;
174 | print $fh "scripts:\n";
175 | print $fh $play;
176 | print $fh $next;
177 | print $fh $prev;
178 | print $fh " stop:\n - C C\n";
179 | print $fh $track_scripts;
180 | close($fh);
181 | return $media_path;
182 | }
183 |
184 | sub get_tttool_parameters {
185 | my ($dbh) = @_;
186 | my $tt_params =
187 | $dbh->selectall_hashref( q(SELECT * FROM config WHERE param LIKE 'tt\_%' ESCAPE '\' AND value IS NOT NULL),
188 | 'param' );
189 | my %formatted_parameters;
190 | foreach my $param ( keys %{$tt_params} ) {
191 | my $parameter = $param;
192 | $parameter =~ s/^tt_//;
193 | $formatted_parameters{$parameter} = $tt_params->{$param}{'value'};
194 | }
195 | return \%formatted_parameters;
196 | }
197 |
198 | sub get_tttool_command {
199 | my ($dbh) = @_;
200 | my $tt_command = get_executable_path('tttool');
201 | my $tt_params = get_tttool_parameters($dbh);
202 | foreach my $param ( sort keys %{$tt_params} ) {
203 | $tt_command .= " --$param $tt_params->{$param}";
204 | }
205 | return $tt_command;
206 | }
207 |
208 | sub run_tttool {
209 | my ( $arguments, $path, $dbh ) = @_;
210 | my $maindir = cwd();
211 | if ($path) {
212 | chdir($path) or die "Can't open '$path': $!";
213 | }
214 | my $tt_command = get_tttool_command($dbh);
215 | print "$tt_command $arguments\n";
216 | my $tt_output = `$tt_command $arguments`;
217 | chdir($maindir);
218 | if ($?) {
219 | error( $tt_output, 1 );
220 | return 0;
221 | } else {
222 | msg( $tt_output, 1 );
223 | return 1;
224 | }
225 | }
226 |
227 | ##exported functions
228 |
229 | sub get_sorted_tracks {
230 | my ($album) = @_;
231 |
232 | #need to jump through some hoops here to get proper numeric sorting:
233 | my @tracks = grep { $_ =~ /^track_/ } keys %{$album};
234 | @tracks = sort { $a <=> $b } map { $_ =~ s/^track_//r } @tracks;
235 | @tracks = map { 'track_' . $_ } @tracks;
236 | return @tracks;
237 | }
238 |
239 | sub make_gme {
240 | my ( $oid, $config, $dbh ) = @_;
241 | my $album = get_album( $oid, $dbh );
242 | $album->{'old_oid'} = $oid;
243 | my $yaml_file = file( $album->{'path'}, sprintf( '%s.yaml', cleanup_filename( $album->{'album_title'} ) ) );
244 | my $fh = $yaml_file->openw();
245 | print $fh "#this file was generated automatically by ttmp32gme\n";
246 | print $fh "product-id: $oid\n";
247 | print $fh 'comment: "CHOMPTECH DATA FORMAT CopyRight 2019 Ver0.00.0001"' . "\n";
248 | print $fh "gme-lang: $config->{'pen_language'}\n";
249 | close($fh);
250 | my $media_path = convert_tracks( $album, $yaml_file, $config, $dbh );
251 | my $codes_file = generate_codes_yaml( $yaml_file, $dbh );
252 | my $yaml = $yaml_file->basename();
253 |
254 | if ( run_tttool( "assemble $yaml", $album->{'path'}, $dbh ) ) {
255 | my $gme_filename = $yaml_file->basename();
256 | $gme_filename =~ s/yaml$/gme/;
257 | my %data = ( 'gme_file' => $gme_filename );
258 | my @selector = ($oid);
259 | updateTableEntry( 'gme_library', 'oid=?', \@selector, \%data, $dbh );
260 | }
261 | remove_library_dir( $media_path, $config->{'library_path'} );
262 | return $oid;
263 | }
264 |
265 | sub create_oids {
266 | my ( $oids, $size, $dbh ) = @_;
267 | my $target_path = get_oid_cache();
268 | my $tt_params = get_tttool_parameters($dbh);
269 | my @files;
270 | my $tt_command = " --code-dim " . $size . " oid-code ";
271 | foreach my $oid ( @{$oids} ) {
272 | my $oid_file = file( $target_path, "$oid-$size-$tt_params->{'dpi'}-$tt_params->{'pixel-size'}.png" );
273 | if ( !-f $oid_file ) {
274 | run_tttool( $tt_command . $oid, "", $dbh )
275 | or die "Could not create oid file: $!";
276 | file("oid-$oid.png")->move_to($oid_file);
277 | }
278 | push( @files, $oid_file );
279 | }
280 | return \@files;
281 | }
282 |
283 | sub copy_gme {
284 | my ( $oid, $config, $dbh ) = @_;
285 | my $album_data = $dbh->selectrow_hashref( q(SELECT path,gme_file FROM gme_library WHERE oid=?), {}, $oid );
286 | if ( !$album_data->{'gme_file'} ) {
287 | make_gme( $oid, $config, $dbh );
288 | $album_data = $dbh->selectrow_hashref( q(SELECT path,gme_file FROM gme_library WHERE oid=?), {}, $oid );
289 | }
290 | my $gme_file = file( $album_data->{'path'}, $album_data->{'gme_file'} );
291 | my $tiptoi_dir = get_tiptoi_dir();
292 | msg( "Copying $album_data->{'gme_file'} to $tiptoi_dir", 1 );
293 | $gme_file->copy_to( file( $tiptoi_dir, $gme_file->basename() ) );
294 | msg( "done.", 1 );
295 | return $oid;
296 | }
297 |
298 | 1;
299 |
--------------------------------------------------------------------------------
/src/assets/css/continue.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/continue.gif
--------------------------------------------------------------------------------
/src/assets/css/edit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/edit.gif
--------------------------------------------------------------------------------
/src/assets/css/fine-uploader-new.min.css:
--------------------------------------------------------------------------------
1 | .qq-btn,.qq-upload-button{box-shadow:0 1px 1px rgba(255,255,255,.37) inset,1px 0 1px rgba(255,255,255,.07) inset,0 1px 0 rgba(0,0,0,.36),0 -2px 12px rgba(0,0,0,.08) inset}.qq-btn{padding:3px 4px;border:1px solid #CCC;border-radius:2px;color:inherit;background-color:#FFF}.qq-upload-delete{background-color:#e65c47;color:#FAFAFA;border-color:#dc523d;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-delete:hover{background-color:#f56b56}.qq-upload-cancel{background-color:#F5D7D7;border-color:#e6c8c8}.qq-upload-cancel:hover{background-color:#ffe1e1}.qq-upload-retry{background-color:#EBF6E0;border-color:#d2ddc7}.qq-upload-retry:hover{background-color:#f7ffec}.qq-upload-continue,.qq-upload-pause{background-color:#00ABC7;color:#FAFAFA;border-color:#2dadc2;text-shadow:0 1px 1px rgba(0,0,0,.55)}.qq-upload-continue:hover,.qq-upload-pause:hover{background-color:#0fbad6}.qq-upload-button{display:inline;width:105px;margin-bottom:10px;padding:7px 10px;text-align:center;float:left;background:#00ABC7;color:#FFF;border-radius:2px;border:1px solid #2dadc2}.qq-upload-button-hover{background:#33B6CC}.qq-upload-button-focus{outline:#000 dotted 1px}.qq-uploader{position:relative;min-height:200px;max-height:490px;overflow-y:hidden;width:inherit;border-radius:6px;background-color:#FDFDFD;border:1px dashed #CCC;padding:20px}.qq-uploader:before{content:attr(qq-drop-area-text) " ";position:absolute;font-size:200%;left:0;width:100%;text-align:center;top:45%;opacity:.25}.qq-upload-drop-area,.qq-upload-extra-drop-area{position:absolute;top:0;left:0;width:100%;height:100%;min-height:30px;z-index:2;background:#F9F9F9;border-radius:4px;border:1px dashed #CCC;text-align:center}.qq-upload-drop-area span{display:block;position:absolute;top:50%;width:100%;margin-top:-8px;font-size:16px}.qq-upload-extra-drop-area{position:relative;margin-top:50px;font-size:16px;padding-top:30px;height:20px;min-height:40px}.qq-upload-drop-area-active{background:#FDFDFD;border-radius:4px;border:1px dashed #CCC}.qq-upload-list{margin:0;padding:0;list-style:none;max-height:450px;overflow-y:auto;box-shadow:0 1px 0 rgba(15,15,50,.14);clear:both}.qq-upload-list li{margin:0;padding:9px;line-height:15px;font-size:16px;color:#424242;background-color:#F6F6F6;border-top:1px solid #FFF;border-bottom:1px solid #DDD}.qq-upload-list li:first-child{border-top:none}.qq-upload-list li:last-child{border-bottom:none}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-failed-text,.qq-upload-file,.qq-upload-pause,.qq-upload-retry,.qq-upload-size,.qq-upload-spinner{margin-right:12px;display:inline}.qq-upload-file{vertical-align:middle;display:inline-block;width:300px;text-overflow:ellipsis;white-space:nowrap;overflow-x:hidden;height:18px}.qq-upload-spinner{display:inline-block;background:url(loading.gif);width:15px;height:15px;vertical-align:text-bottom}.qq-drop-processing{display:block}.qq-drop-processing-spinner{display:inline-block;background:url(processing.gif);width:24px;height:24px;vertical-align:text-bottom}.qq-upload-cancel,.qq-upload-continue,.qq-upload-delete,.qq-upload-pause,.qq-upload-retry,.qq-upload-size{font-size:12px;font-weight:400;cursor:pointer;vertical-align:middle}.qq-upload-status-text{font-size:14px;font-weight:700;display:block}.qq-upload-failed-text{display:none;font-style:italic;font-weight:700}.qq-upload-failed-icon{display:none;width:15px;height:15px;vertical-align:text-bottom}.qq-upload-fail .qq-upload-failed-text,.qq-upload-retrying .qq-upload-failed-text{display:inline}.qq-upload-list li.qq-upload-success{background-color:#EBF6E0;color:#424242;border-bottom:1px solid #D3DED1;border-top:1px solid #F7FFF5}.qq-upload-list li.qq-upload-fail{background-color:#F5D7D7;color:#424242;border-bottom:1px solid #DECACA;border-top:1px solid #FCE6E6}.qq-progress-bar{display:block;background:#00abc7;width:0;height:15px;border-radius:6px;margin-bottom:3px}.qq-total-progress-bar{height:25px;border-radius:9px}.qq-total-progress-bar-container{margin-left:9px;display:inline;float:right;width:500px}INPUT.qq-edit-filename{position:absolute;opacity:0;filter:alpha(opacity=0);z-index:-1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"}.qq-upload-file.qq-editable{cursor:pointer;margin-right:4px}.qq-edit-filename-icon.qq-editable{display:inline-block;cursor:pointer}.qq-hide,.qq-uploader DIALOG{display:none}INPUT.qq-edit-filename.qq-editing{position:static;height:28px;padding:0 8px;margin-right:10px;margin-bottom:-5px;border:1px solid #ccc;border-radius:2px;font-size:16px;opacity:1;filter:alpha(opacity=100);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"}.qq-edit-filename-icon{display:none;background:url(edit.gif);width:15px;height:15px;vertical-align:text-bottom;margin-right:16px}.qq-thumbnail-selector{vertical-align:middle;margin-right:12px}.qq-uploader DIALOG[open]{display:block}.qq-uploader DIALOG .qq-dialog-buttons{text-align:center;padding-top:10px}.qq-uploader DIALOG .qq-dialog-buttons BUTTON{margin-left:5px;margin-right:5px}.qq-uploader DIALOG .qq-dialog-message-selector{padding-bottom:10px}.qq-uploader DIALOG::backdrop{background-color:rgba(0,0,0,.7)}/*# sourceMappingURL=fine-uploader-new.min.css.map */
--------------------------------------------------------------------------------
/src/assets/css/fine-uploader-new.min.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["_build/fine-uploader-new.css"],"names":[],"mappings":"AAMA,QAkDA,kBAWI,WAAY,EAAE,IAAI,IAAI,sBAA0B,MAAO,IAAI,EAAE,IAAI,sBAA0B,MAAO,EAAE,IAAI,EAAE,gBAAqB,EAAE,KAAK,KAAK,gBAAoB,MA7DnK,QAGI,QAAS,IAAI,IACb,OAAQ,IAAI,MAAM,KAClB,cAAe,IACf,MAAO,QACP,iBAAkB,KAKtB,kBAEI,iBAAkB,QAClB,MAAO,QACP,aAAc,QACd,YAAa,EAAE,IAAI,IAAI,gBAE3B,wBACI,iBAAkB,QAEtB,kBAEI,iBAAkB,QAClB,aAAc,QAElB,wBACI,iBAAkB,QAEtB,iBAEI,iBAAkB,QAClB,aAAc,QAElB,uBACI,iBAAkB,QAEJ,oBAAlB,iBACI,iBAAkB,QAClB,MAAO,QACP,aAAc,QACd,YAAa,EAAE,IAAI,IAAI,gBAEH,0BAAxB,uBACI,iBAAkB,QAKtB,kBACI,QAAS,OACT,MAAO,MACP,cAAe,KACf,QAAS,IAAI,KACb,WAAY,OACZ,MAAO,KACP,WAAY,QACZ,MAAO,KACP,cAAe,IACf,OAAQ,IAAI,MAAM,QAGtB,wBACI,WAAY,QAEhB,wBACI,QAAoB,KAAP,OAAJ,IAMb,aACI,SAAU,SACV,WAAY,MACZ,WAAY,MACZ,WAAY,OACZ,MAAO,QACP,cAAe,IACf,iBAAkB,QAClB,OAAQ,IAAI,OAAO,KACnB,QAAS,KAEb,oBACI,QAAS,wBAAwB,IACjC,SAAU,SACV,UAAW,KACX,KAAM,EACN,MAAO,KACP,WAAY,OACZ,IAAK,IACL,QAAS,IAEb,qBAAsB,2BAClB,SAAU,SACV,IAAK,EACL,KAAM,EACN,MAAO,KACP,OAAQ,KACR,WAAY,KACZ,QAAS,EACT,WAAY,QACZ,cAAe,IACf,OAAQ,IAAI,OAAO,KACnB,WAAY,OAEhB,0BACI,QAAS,MACT,SAAU,SACV,IAAK,IACL,MAAO,KACP,WAAY,KACZ,UAAW,KAEf,2BACI,SAAU,SACV,WAAY,KACZ,UAAW,KACX,YAAa,KACb,OAAQ,KACR,WAAY,KAEhB,4BACI,WAAY,QACZ,cAAe,IACf,OAAQ,IAAI,OAAO,KAEvB,gBACI,OAAQ,EACR,QAAS,EACT,WAAY,KACZ,WAAY,MACZ,WAAY,KACZ,WAAY,EAAI,IAAI,EAAI,mBACxB,MAAO,KAMX,mBACI,OAAQ,EACR,QAAS,IACT,YAAa,KACb,UAAW,KACX,MAAO,QACP,iBAAkB,QAClB,WAAY,IAAI,MAAM,KACtB,cAAe,IAAI,MAAM,KAE7B,+BACI,WAAY,KAEhB,8BACI,cAAe,KAInB,kBACqC,oBAArC,kBADqC,uBADrC,gBAEmB,iBADA,iBADkB,gBAApB,mBAGb,aAAc,KACd,QAAS,OAEb,gBACI,eAAgB,OAChB,QAAS,aACT,MAAO,MACP,cAAe,SACf,YAAa,OACb,WAAY,OACZ,OAAQ,KAEZ,mBACI,QAAS,aACT,WAAY,iBACZ,MAAO,KACP,OAAQ,KACR,eAAgB,YAEpB,oBACI,QAAS,MAEb,4BACI,QAAS,aACT,WAAY,oBACZ,MAAO,KACP,OAAQ,KACR,eAAgB,YAEH,kBACoB,oBAArC,kBAAmB,iBADiB,iBAApC,gBAEI,UAAW,KACX,YAAa,IACb,OAAQ,QACR,eAAgB,OAEpB,uBACI,UAAW,KACX,YAAa,IACb,QAAS,MAEb,uBACI,QAAS,KACT,WAAY,OACZ,YAAa,IAEjB,uBACI,QAAQ,KACR,MAAM,KACN,OAAO,KACP,eAAe,YAEnB,uCAGA,2CAFI,QAAS,OAKb,qCACI,iBAAkB,QAClB,MAAO,QACP,cAAe,IAAI,MAAM,QACzB,WAAY,IAAI,MAAM,QAE1B,kCACI,iBAAkB,QAClB,MAAO,QACP,cAAe,IAAI,MAAM,QACzB,WAAY,IAAI,MAAM,QAE1B,iBACI,QAAS,MAET,WAAY,QACZ,MAAO,EACP,OAAQ,KACR,cAAe,IACf,cAAe,IAGnB,uBACI,OAAQ,KACR,cAAe,IAGnB,iCACI,YAAa,IACb,QAAS,OACT,MAAO,MACP,MAAO,MAGX,uBACI,SAAU,SACV,QAAS,EACT,OAAQ,iBACR,QAAS,GACT,WAAY,qDAGhB,4BACI,OAAQ,QACR,aAAc,IAGlB,mCACI,QAAS,aACT,OAAQ,QA2BZ,SAsBA,oBACI,QAAS,KA/Cb,kCACI,SAAU,OACV,OAAQ,KACR,QAAS,EAAE,IACX,aAAc,KACd,cAAe,KACf,OAAQ,IAAI,MAAM,KAClB,cAAe,IACf,UAAW,KAEX,QAAS,EACT,OAAQ,mBACR,WAAY,uDAGhB,uBACI,QAAS,KACT,WAAY,cACZ,MAAO,KACP,OAAQ,KACR,eAAgB,YAChB,aAAc,KAUlB,uBACI,eAAgB,OAChB,aAAc,KAiBlB,0BACI,QAAS,MAGb,uCACI,WAAY,OACZ,YAAa,KAGjB,8CACI,YAAa,IACb,aAAc,IAGlB,gDACI,eAAgB,KAGpB,8BACI,iBAAkB"}
--------------------------------------------------------------------------------
/src/assets/css/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/loading.gif
--------------------------------------------------------------------------------
/src/assets/css/pause.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/pause.gif
--------------------------------------------------------------------------------
/src/assets/css/print.css:
--------------------------------------------------------------------------------
1 | @page {
2 | size: A4;
3 | margin: 0.5in;
4 | }
5 |
6 | .img-6mm {
7 | max-width: 36px !important;
8 | min-width: 36px !important;
9 | max-height: 36px !important;
10 | min-height: 36px !important;
11 | }
12 |
13 | .img-18mm {
14 | max-width: 103px !important;
15 | min-width: 103px !important;
16 | max-height: 103px !important;
17 | min-height: 103px !important;
18 | }
19 |
20 | .img-24mm {
21 | max-width: 138px !important;
22 | min-width: 138px !important;
23 | max-height: 138px !important;
24 | min-height: 138px !important;
25 | }
26 |
27 | .track-img-container {
28 | display: inline-block;
29 | vertical-align: middle;
30 | border-radius: 5px;
31 | border: 1px solid #cccccc;
32 | margin-right: 10px;
33 | overflow: hidden;
34 | }
35 | .track-title {
36 | width: 100%;
37 | max-width: 0;
38 | }
39 | .runtime {
40 | padding-left: 10px;
41 | }
42 |
43 | .play-img {
44 | position: absolute;
45 | left: 0px;
46 | top: 0px;
47 | }
48 |
49 | .power-on {
50 | position: absolute;
51 | width: 103px;
52 | height: 103px;
53 | left: 15px;
54 | top: 0px;
55 | background-color: #ffffff;
56 | box-shadow: inset 0 0 0 1000px #ffffff;
57 | font-size: 90px;
58 | z-index: 1000;
59 | border-radius: 51px;
60 | overflow: hidden;
61 | text-align: center;
62 | }
63 |
64 | .power-on-inline {
65 | display: inline-block;
66 | vertical-align: middle;
67 | margin-right: 20px;
68 | }
69 |
70 | .play-control {
71 | padding: 17px 25px !important;
72 | overflow: hidden;
73 | background-color: #ffffff !important;
74 | }
75 |
76 | .album-controls {
77 | margin: 5px 0px;
78 | position: sticky;
79 | left: 0;
80 | bottom: 0;
81 | }
82 |
83 | .track-list>.list-group-item {
84 | padding: 5px 10px;
85 | }
86 |
87 | .cover-img {
88 | width: 100%;
89 | }
90 |
91 | #general-controls, .album {
92 | page-break-inside: avoid;
93 | }
94 |
95 |
96 | @media print {
97 | /* make sure the responsiveness of bootstrap does not mess up our print layout.
98 | a4 usable page width with 0.5 in margins (default for firefox where it is not changable) is
99 | 184.503mm/25.4*72*2 =1046 -2 (for borders) = 1044 thus our overall scale is 56.692845103 pixel per cm */
100 | .container {
101 | width: 1044px;
102 | }
103 | }
104 |
105 | @-moz-document url-prefix() {
106 | @media print {
107 | /* firefox scales a little bit different than chrome. Hence we override the container width for firefox here */
108 | .container {
109 | width: 1036px;
110 | }
111 | }
112 | }
--------------------------------------------------------------------------------
/src/assets/css/processing.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/processing.gif
--------------------------------------------------------------------------------
/src/assets/css/retry.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/retry.gif
--------------------------------------------------------------------------------
/src/assets/css/trash.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/css/trash.gif
--------------------------------------------------------------------------------
/src/assets/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/src/assets/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/assets/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/src/assets/images/Screen_Shot_cd-booklet.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/Screen_Shot_cd-booklet.jpg
--------------------------------------------------------------------------------
/src/assets/images/Screen_Shot_list.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/Screen_Shot_list.jpg
--------------------------------------------------------------------------------
/src/assets/images/Screen_Shot_print-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/Screen_Shot_print-config.png
--------------------------------------------------------------------------------
/src/assets/images/Screen_Shot_tiles.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/Screen_Shot_tiles.jpg
--------------------------------------------------------------------------------
/src/assets/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/favicon.ico
--------------------------------------------------------------------------------
/src/assets/images/not_available-generic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/not_available-generic.png
--------------------------------------------------------------------------------
/src/assets/images/oid-table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/oid-table.png
--------------------------------------------------------------------------------
/src/assets/images/ttmp32gme_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/ttmp32gme_logo.png
--------------------------------------------------------------------------------
/src/assets/images/waiting-generic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/waiting-generic.png
--------------------------------------------------------------------------------
/src/assets/images/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thawn/ttmp32gme/e3164dfa3793fc6c19d398fb7cd4fa7d29495f8c/src/assets/images/white.png
--------------------------------------------------------------------------------
/src/assets/js/jquery.matchHeight-min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jquery-match-height 0.7.0 by @liabru
3 | * http://brm.io/jquery-match-height/
4 | * License MIT
5 | */
6 | !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=-1,o=-1,i=function(t){return parseFloat(t)||0},a=function(e){var o=1,a=t(e),n=null,r=[];return a.each(function(){var e=t(this),a=e.offset().top-i(e.css("margin-top")),s=r.length>0?r[r.length-1]:null;null===s?r.push(e):Math.floor(Math.abs(n-a))<=o?r[r.length-1]=s.add(e):r.push(e),n=a}),r},n=function(e){var o={
7 | byRow:!0,property:"height",target:null,remove:!1};return"object"==typeof e?t.extend(o,e):("boolean"==typeof e?o.byRow=e:"remove"===e&&(o.remove=!0),o)},r=t.fn.matchHeight=function(e){var o=n(e);if(o.remove){var i=this;return this.css(o.property,""),t.each(r._groups,function(t,e){e.elements=e.elements.not(i)}),this}return this.length<=1&&!o.target?this:(r._groups.push({elements:this,options:o}),r._apply(this,o),this)};r.version="0.7.0",r._groups=[],r._throttle=80,r._maintainScroll=!1,r._beforeUpdate=null,
8 | r._afterUpdate=null,r._rows=a,r._parse=i,r._parseOptions=n,r._apply=function(e,o){var s=n(o),h=t(e),l=[h],c=t(window).scrollTop(),p=t("html").outerHeight(!0),d=h.parents().filter(":hidden");return d.each(function(){var e=t(this);e.data("style-cache",e.attr("style"))}),d.css("display","block"),s.byRow&&!s.target&&(h.each(function(){var e=t(this),o=e.css("display");"inline-block"!==o&&"flex"!==o&&"inline-flex"!==o&&(o="block"),e.data("style-cache",e.attr("style")),e.css({display:o,"padding-top":"0",
9 | "padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),l=a(h),h.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||"")})),t.each(l,function(e,o){var a=t(o),n=0;if(s.target)n=s.target.outerHeight(!1);else{if(s.byRow&&a.length<=1)return void a.css(s.property,"");a.each(function(){var e=t(this),o=e.attr("style"),i=e.css("display");"inline-block"!==i&&"flex"!==i&&"inline-flex"!==i&&(i="block");var a={
10 | display:i};a[s.property]="",e.css(a),e.outerHeight(!1)>n&&(n=e.outerHeight(!1)),o?e.attr("style",o):e.css("display","")})}a.each(function(){var e=t(this),o=0;s.target&&e.is(s.target)||("border-box"!==e.css("box-sizing")&&(o+=i(e.css("border-top-width"))+i(e.css("border-bottom-width")),o+=i(e.css("padding-top"))+i(e.css("padding-bottom"))),e.css(s.property,n-o+"px"))})}),d.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||null)}),r._maintainScroll&&t(window).scrollTop(c/p*t("html").outerHeight(!0)),
11 | this},r._applyDataApi=function(){var e={};t("[data-match-height], [data-mh]").each(function(){var o=t(this),i=o.attr("data-mh")||o.attr("data-match-height");i in e?e[i]=e[i].add(o):e[i]=o}),t.each(e,function(){this.matchHeight(!0)})};var s=function(e){r._beforeUpdate&&r._beforeUpdate(e,r._groups),t.each(r._groups,function(){r._apply(this.elements,this.options)}),r._afterUpdate&&r._afterUpdate(e,r._groups)};r._update=function(i,a){if(a&&"resize"===a.type){var n=t(window).width();if(n===e)return;e=n;
12 | }i?-1===o&&(o=setTimeout(function(){s(a),o=-1},r._throttle)):s(a)},t(r._applyDataApi),t(window).bind("load",function(t){r._update(!1,t)}),t(window).bind("resize orientationchange",function(t){r._update(!0,t)})});
--------------------------------------------------------------------------------
/src/assets/js/print.js:
--------------------------------------------------------------------------------
1 | var cssPagedMedia = (function() {
2 | var style = document.createElement('style');
3 | document.head.appendChild(style);
4 | return function(rule) {
5 | style.innerHTML = rule;
6 | };
7 | }());
8 |
9 | cssPagedMedia.size = function(size) {
10 | cssPagedMedia('@page {size: ' + size + '}');
11 | };
12 |
13 | var notify = function($caller, title, message, popover_class, timeout) {
14 | $caller.attr({
15 | 'title' : title,
16 | 'data-content' : message
17 | });
18 | $caller.popover('show');
19 | $caller.next('.popover').find('.popover-content').addClass(popover_class);
20 | setTimeout(function() {
21 | $caller.popover('destroy');
22 | }, timeout);
23 | }
24 |
25 | var testCheckBox = function(s) {
26 | if ($(s).is(':checked')) {
27 | return 'TRUE';
28 | } else {
29 | return 'FALSE';
30 | }
31 | }
32 |
33 | var getElementValues = function($id) {
34 | var filterVars = {};
35 | $id.find('input').not(':button').each(function() {
36 | if ($(this).is(':checkbox')) {
37 | filterVars[this.name] = testCheckBox(this);
38 | } else {
39 | filterVars[this.name] = $(this).val();
40 | }
41 | });
42 | return filterVars;
43 | }
44 |
45 | var fillInElement = function($id, data) {
46 | for ( var i in data) {
47 | if (data[i] === 'TRUE' || data[i] === 'FALSE') {
48 | if (data[i] === 'TRUE') {
49 | $id.find('input[name=' + i + ']').prop('checked', true);
50 | if (i !== 'enabled') {
51 | $id.find('input[name=' + i + ']').change();
52 | }
53 | } else {
54 | $id.find('input[name=' + i + ']').prop('checked', false);
55 | if (i !== 'enabled') {
56 | $id.find('input[name=' + i + ']').change();
57 | }
58 | }
59 | } else {
60 | $id.find('input[name=' + i + ']').val(data[i]);
61 | $id.find('input[name=' + i + ']').change();
62 | }
63 | }
64 | cssPagedMedia.size($id.find('input[name=print_page_size]').val());
65 | $id.find('.preset').removeClass('active');
66 | $('#' + $id.find('input[name=print_preset]').val()).addClass('active')
67 | $id.find('button').each(function() {
68 | $(this).data('item-id', $id);
69 | });
70 | $id.find('input').data('item-id', $id);
71 | }
72 |
73 | var selectPreset = function(preset) {
74 | var presets = {
75 | 'list' : {
76 | 'print_preset' : 'list',
77 | 'print_show_cover' : 'TRUE',
78 | 'print_show_album_info' : 'TRUE',
79 | 'print_show_album_controls' : 'TRUE',
80 | 'print_show_tracks' : 'TRUE',
81 | 'print_show_general_controls' : 'FALSE',
82 | 'print_num_cols' : 1,
83 | 'print_tile_size' : ''
84 | },
85 | 'tiles' : {
86 | 'print_preset' : 'tiles',
87 | 'print_show_cover' : 'TRUE',
88 | 'print_show_album_info' : 'FALSE',
89 | 'print_show_album_controls' : 'FALSE',
90 | 'print_show_tracks' : 'FALSE',
91 | 'print_show_general_controls' : 'TRUE',
92 | 'print_num_cols' : 3,
93 | 'print_tile_size' : ''
94 | },
95 | 'cd' : {
96 | 'print_preset' : 'cd',
97 | 'print_show_cover' : 'FALSE',
98 | 'print_show_album_info' : 'FALSE',
99 | 'print_show_album_controls' : 'TRUE',
100 | 'print_show_tracks' : 'TRUE',
101 | 'print_show_general_controls' : 'FALSE',
102 | 'print_num_cols' : 1,
103 | 'print_tile_size' : '12'
104 | }
105 | };
106 | var $id = $('#config');
107 | $id.find('.preset').removeClass('active');
108 | $('#' + $id.find('input[name=print_preset]').val()).addClass('active');
109 | fillInElement($id, presets[preset]);
110 | }
111 |
112 | var getConfig = function() {
113 | var filterVars = {};
114 | $.post(document.baseURI,
115 | 'action=get_config&data=' + encodeURIComponent(JSON.stringify(filterVars)),
116 | function(data, textStatus, jqXHR) {
117 | if (data.success) {
118 | var $id = $('#config');
119 | fillInElement($id, data.element);
120 |
121 | } else {
122 | notify($('#config-save'), '', jqXHR.statusText, 'bg-danger', 4000);
123 | }
124 | }, 'json').fail(function() {
125 | notify($('#config-save'), '', 'Connection error', 'bg-danger', 4000);
126 | });
127 | }
128 |
129 | var saveConfig = function($id) {
130 | var elementVars = getElementValues($id);
131 | $.post(
132 | document.baseURI,
133 | 'action=save_config&data=' + encodeURIComponent(JSON.stringify(elementVars)),
134 | function(data,textStatus,jqXHR) {
135 | if (data.success) {
136 | fillInElement($id, data.element);
137 | notify($('#config-save'), '', jqXHR.statusText, 'bg-success',
138 | 2000);
139 | } else {
140 | notify($('#config-save'), '', jqXHR.statusText, 'bg-danger',
141 | 4000);
142 | }
143 | }, 'json').fail(
144 | function() {
145 | notify($('#config-save'), '', 'Connection error', 'bg-danger',
146 | 4000);
147 | });
148 | }
149 |
150 | var adaptLayout = function($id) {
151 | if ($id.is(':checkbox')) {
152 | toggleField($id);
153 | }
154 | var albumColumns = 0;
155 | $(
156 | 'input[name=print_show_cover], ' + 'input[name=print_show_album_info], '
157 | + 'input[name=print_show_tracks]').each(function() {
158 | if ($(this).prop('checked')) {
159 | albumColumns++;
160 | }
161 | });
162 | // adjust the width of the columns for each album
163 | var numCols = 12 / albumColumns << 0;
164 | var columnClass = 'col-xs-' + numCols;
165 | $('.cover').removeClass().addClass(columnClass + ' cover');
166 | $('.album-info').removeClass().addClass(columnClass + ' album-info');
167 | $('.tracks').removeClass().addClass(columnClass + ' tracks');
168 |
169 | // move around the album controls if necessary
170 | if ($('input[name=print_show_album_controls]').prop('checked')) {
171 | if ($('input[name=print_show_album_info]').prop('checked')) {
172 | attachAlbumControlsTo('.album-info');
173 | $('.album-controls').addClass('btn-group-justified');
174 | } else if ($('input[name=print_show_cover]').prop('checked')) {
175 | attachAlbumControlsTo('.cover');
176 | $('.album-controls').addClass('btn-group-justified');
177 | } else {
178 | attachAlbumControlsTo('.tracks');
179 | $('.album-controls').removeClass('btn-group-justified');
180 | }
181 | }
182 |
183 | // make sure we always see the power-on button
184 | if ($('input[name=print_show_cover]').prop('checked')) {
185 | attachPowerOnTo('.cover');
186 | $('.power-on').css('position', 'absolute');
187 | $('.power-on').removeClass('power-on-inline');
188 | } else if ($('input[name=print_show_album_info]').prop('checked')) {
189 | attachPowerOnTo('.album-info');
190 | $('.power-on').css('position', 'relative');
191 | $('.power-on').removeClass('power-on-inline');
192 | } else {
193 | attachPowerOnTo('.tracks');
194 | $('.power-on').css('position', 'relative');
195 | $('.power-on').addClass('power-on-inline');
196 | }
197 | }
198 |
199 | var attachAlbumControlsTo = function(selector) {
200 | $('.album').each(function() {
201 | if (selector === '.tracks') {
202 | $(this).find('.album-controls').prependTo($(this).find(selector));
203 | } else {
204 | $(this).find('.album-controls').appendTo($(this).find(selector));
205 | }
206 | });
207 | }
208 |
209 | var attachPowerOnTo = function(selector) {
210 | $('.album').each(function() {
211 | $(this).find('.power-on').prependTo($(this).find(selector));
212 | });
213 | }
214 |
215 | var toggleField = function($checkbox) {
216 | var selector = '.' + $checkbox.attr('name').slice(11).replace(/_/g, '-')
217 | if ($checkbox.prop('checked')) {
218 | $(selector).show();
219 | } else {
220 | $(selector).hide();
221 | }
222 | }
223 |
224 | var changeTileSize = function($id) {
225 | if ($id.val()) {
226 | var PPcm = 56.692845103;
227 | var size = $id.val() * PPcm;
228 | var column_sizes = [6, 4];
229 | $('.album').css({ 'min-width': size + 'px', 'min-height': size + 'px', 'max-width': size + 'px', 'max-height': size + 'px', 'overflow': 'hidden'});
230 | $('.album').find('.tracks').each(function(unused, tracks) {
231 | resetTracks($(tracks).find('ul'));
232 | var i = 0;
233 | var $ul = $(tracks).find('ul');
234 | while ($ul.prop('scrollHeight') > size - 156 && i < column_sizes.length ) {
235 | $ul.find('li').removeClass().addClass('list-group-item col-xs-' + column_sizes[i++]);
236 | $ul.find('.track-title').css({'overflow':'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap'});
237 | }
238 | });
239 | /**
240 | * TODO detect track ul overflow ( https://stackoverflow.com/questions/7138772/how-to-detect-overflow-in-div-element )
241 | * and increase number of columns as needed ( https://stackoverflow.com/questions/19836567/bootstrap-3-multi-column-within-a-single-ul-not-floating-properly )
242 | */
243 | } else {
244 | $('.album').removeAttr('style');
245 | $('.album').find('.tracks').each(function(unused, tracks) {
246 | resetTracks($(tracks).find('ul'));
247 | });
248 | }
249 | }
250 |
251 | var resetTracks = function($ul) {
252 | $ul.removeClass('row');
253 | $ul.find('li').removeClass().addClass('list-group-item');
254 | $ul.find('.track-title').css({'overflow':'visible', 'text-overflow': 'clip', 'white-space': 'normal'});
255 | }
256 |
257 | var changeNumberOfColumns = function($id) {
258 | if ($id.val() > 1) {
259 | var colWidth = 12 / $id.val() << 0;
260 | var columnClass = 'col-xs-' + colWidth;
261 | $('.album').parent().removeClass().addClass(columnClass);
262 | $('.album').parent().appendTo('#wrap-all-print');
263 | $('.album-row').remove();
264 | var rowHTML = '
';
265 | var rowCount = 0;
266 | $('.album').parent().each( function(albumCount){
267 | if ( (albumCount % $id.val()) === 0 ) {
268 | rowCount++;
269 | $('#wrap-all-print').append('
');
270 | }
271 | $(this).appendTo('#row-' + rowCount);
272 | });
273 | $('#general-controls').appendTo('#wrap-all-print');
274 | } else {
275 | $('.album').parent().removeClass().addClass('row');
276 | $('.album').parent().appendTo('#wrap-all-print');
277 | $('.album-row').remove();
278 | $('#general-controls').appendTo('#wrap-all-print');
279 | }
280 | }
281 |
282 | var savePDF = function() {
283 | $.post(
284 | document.baseURI,
285 | 'action=save_pdf&data=' + encodeURIComponent(JSON.stringify({content: $('#wrap-all-print').html()})),
286 | function(data,textStatus,jqXHR) {
287 | if (data.success) {
288 | setTimeout(function() { window.open('/print.pdf'); }, 10000);
289 | notify($('#pdf-save'), '', 'Creating pdf, please wait about 10 s... (you need to allow popups to see the pdf. otherwise open "http://'+window.location.host+'/print.pdf" manually', 'bg-info',
290 | 10000);
291 | } else {
292 | notify($('#pdf-save'), '', jqXHR.statusText, 'bg-danger',
293 | 4000);
294 | }
295 | }, 'json').fail(
296 | function() {
297 | notify($('#pdf-save'), '', 'Connection error', 'bg-danger',
298 | 4000);
299 | });
300 |
301 | }
302 |
303 | $(function() {
304 | // fetch the configuration from the database
305 | getConfig();
306 |
307 | tileStyle = (function() {
308 | // Create the
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
146 |
147 |
148 |
149 |
150 |
157 |
158 |
159 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
{ $title }
170 |
171 |
172 |
173 |
174 | { $content }
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |