Skip to content

Commit

Permalink
Improved some styles and fixed artwork bug with special characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gray Watson committed Feb 7, 2016
1 parent c6fe720 commit 255324f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ To get this working you can package it as a jar if you'd like by doing:

1. mvn package
2. It will create in the target/ directory something like: itunesjukebox-X.X...-executable.jar
3. Rename that file from the target/ directory to itunesjukebox.jar
3. Rename that file to itunesjukebox.jar

Run the application with:

1. Run the jar with java -jar itunesjukebox.jar
2. You can override properties using a '-p property-file' argument.
1. Run the jar with: java -jar itunesjukebox.jar
2. You can override properties using a '-p property-file' argument.
3. By default the web-server starts on port 8080 although that can be overridden
4. Go to http://localhost:8080 which will encourage you to go to /admin/
5. Enter the admin password for this run of the application.
Expand Down
3 changes: 0 additions & 3 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
- test with android
- progress bar or other feature to showing track position
- better css lists (light/dark shading on rows)
- handle moving off of the playlist better
- maybe see what playlist is playing each time and if not tmp then stop
- show the times of the tracks
- show the current play time or maybe time left or something
- some way to persist votes for next time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,14 @@ public static int[] getIdsPlaylist(String playList) {
* Load any track artwork from the disk.
*/
public static Artwork loadTrackArtwork(Track track, String playList) throws IOException {
char leftDoubleAngleQuotation = 171; // character version of <<
char rightDoubleAngleQuotation = 187; // character version of >>
String results = runCommand(//
"tell artwork 1 of track id " + track.getLibraryId() + " of user playlist \"" //
+ playList + "\"\n" //
+ " set srcBytes to raw data\n" //
+ " if format is <<class PNG>> then\n" //
+ " if format is " + leftDoubleAngleQuotation + "class PNG " + rightDoubleAngleQuotation
+ " then\n" //
+ " set ext to \"png\"\n" //
+ " else\n" //
+ " set ext to \"jpg\"\n" //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ private void doMaintenance() {
} else {
System.out.println("Playing status is: " + playingInfo);
}
if (playingInfo.getId() < 0) {
// we aren't playing the right playlist all of a sudden, bail
System.err.println("ERROR: We aren't playing in playlist: " + AdminController.TMP_PLAYLIST);
return;
}
// remove any other tracks before it, adding 1 to their play-count
for (int i = 1; i < playingInfo.getIndex(); i++) {
// remove the first one X times, not i
Expand Down
3 changes: 1 addition & 2 deletions src/main/webapp/controller/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

[#if initialized ]
<table border="1" cellpadding="3">
<tr><th colspan="3"> What's Playing </th></tr>
<tr><th> Name </th><th> Artist </th><th> Votes </th></tr>
<tbody id="menuRows">
<tr><th> Playing Name </th><th> Artist </th><th> Votes </th></tr>
</tbody>
</table>
[#else]
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/controller/songs/one.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<img id="voteDown" src="/images/vote_down.png" height="64" alt="Vote down for song" />
[/#if]
</p>
<!-- NOTE: because we dynamically load the artwork, we can't test for it -->
<p> <img src="/artwork?id=${track.id?c}" alt="Album artwork" height="180" /> </p>

<script>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $(document).ready(function() {
var intervalMillis = 3000;
var refresh = function() {
$.getJSON("/ajax/whatsPlaying", function(tracks) {
var rows = [];
var rows = [ "<tr><th> Playing Name </th><th> Artist </th><th> Votes </th></tr>\n" ];
tracks.forEach(function(track) {
var row = "<tr><td> <a href=\"/songs/one?id=" + track.id + "\">" + track.name + "</a> ";
if (track.isVideo) {
Expand Down
19 changes: 19 additions & 0 deletions src/main/webapp/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,22 @@ a, .button {
padding:3px;
text-decoration: none;
}

table {
border-collapse: collapse;
width: 100%;
}

th, td {
text-align: left;
padding: 8px;
}

tr:nth-of-type(odd) {
background-color: #F2F2F2;
}

th {
background-color: #F2F2F2;
text-align: center;
}

0 comments on commit 255324f

Please sign in to comment.