Skip to content

ravermeister/lastfmtube

Repository files navigation

Author Jonny Rimkus <jonny@rimkus.it>
Website https://www.rimkus.it
License http://www.wtfpl.net/
Demo https://lastfm.rimkus.it

Requirements

  • PHP >= 5.6 (last test with 8.0)
  • PHP PDO SQLite tested (any PDO DB should work, but untested)
  • Composer (See composer.json)
  • Lastf.fm Account with API Support
  • Youtube Account with API Supprt

Installation

  1. Place this folder somewhere under your document Root e.g.: http://example.com/lfmtube
  2. run composer install
  3. copy the file conf/example.settings.json to conf/settings.json
  4. create a Last.fm User with a Developer API key
  5. create a Youtube User with a Developer API Key
  6. enter the API keys in the settings.json
  7. open http://example.com/lfmtube and enjoy

Docker

  1. copy the file conf/example.settings.json to conf/settings.json
  2. create a Last.fm User with a Developer API key
  3. create a Youtube User with a Developer API Key
  4. enter the API keys in the settings.json
  5. run docker.sh or docker.bat
  6. open http://localhost and enjoy

About

The Last.fm Youtube Radio searches and plays the listened tracks of a given Last.fm User on YouTube. It is possible to search for alternative Youtube Videos or enter a video url directly. The Tracks which have a fixed Video Id will have a '*' prefixed. You can create your own playlist via menu 'add to playlist'. Additionally there is a Chart list which will be updated each time a song is heared. The Chart Counter works as follows:

  • get the length of the Song divided by 2. if it is greater than 2 minutes use 2 minutes as timeout, otherwise use calculated length.
  • when the Timeout is reached, increase playcount for Song.

The Timer is designed to stop when player is paused, and will continue when the player continues to play.

Hotkeys

The following global Shortcut keys are supported:

Key binding Command Control
space Play/Pause Player
up Volume Up Player
down Volume Down Player
left *Rewind Track Player
right *Fast Forward Track Player
ctrl+left Previous Track Player
ctrl+right Next Track Player
ctrl+1 Player Window Page Navigation
ctrl+2 Last.fm Playlist Page Navigation
ctrl+3 Custom User Playlist Page Navigation
ctrl+4 Topsongs Playlist Page Navigation
ctrl+5 Last.fm Users Page Navigation
ctrl+shift+right next Page Playlist Navigation
ctrl+shift+left previous Page Playlist Navigation

*The forward/rewind amount of time is increased when the functions is called fast in a row, and resetted to default afterwards.

Personal Songlist

You can send any Title to your personal song list (will be stored in browser cache), which is saved during a browser restart.

Listen to other Last.fm User's Song Timeline

You can search any Last.fm User and listen to the Song Timeline.

Admin interface

There is an admin php cli Interface for Importing the replacement.csv Files and generating the sitemap.xml file.
Call php admin.php inside the lastfmtube Folder for more info.

replacements.csv

You can use Regular Expressions for Replacing Artist and Title information if the Song information is messy, sothat the search string that is send to youtube can be corrected in an efficient way. The csv is stored in the database after importing through the admin cli Interface. New- and Changed Files can be (re-)Imported with the admin interface at any time. See the init.replacement.example.csv for more details.

Directory Structure:

  • conf Configuration Files and SQLite Database
  • conf/settings.json copy from settings.example.json, here you have to adjust the Youtube/Last.fm settings for the player.
  • conf/init.replacements_example.csv This is an example file for the Track correction CSV files which you can import via the Admin-cli interface. Regular Expression Groups can be used to define replacements for a specific part of a track to e.g. remove [unnknown] from the Song Titles, extract the artist name from the title etc.
  • conf/lasttube.db this is the sqlite Database (will be created automatically)
  • themes place new themes into this directory. (theming is untested) simply copy an existing theme directory and rename it to your new theme name (and adjust settings.json as needed)
  • locale here you can localize the Strings. currently supported langs: english and german to create a new language, copy an existing language file and rename it to the country specific code, e.g. locale_nl.json for netherland.
  • js main js and dependency config. Tie all js stuff together
  • js/control all js Controller (player,page,playlist)
  • js/control/page js Page Controller (navigation etc.)
  • js/control/player js Player Controller (including chart timer)
  • js/control/playlist js Playlist Controller (actions in the playlist view)
  • js/lib all required js dependecies e.g JQuery/Vuejs files
  • js/vueimpl all Vuejs instances
  • js/vueimpl/page Vue bindings for welcome page
  • js/vueimpl/player Vue bindings for the player page
  • js/vueimpl/playlist Vue bindings for the playlist page
  • js/vueimpl/userlist Vue bindings for the userlist page
  • php/json all required php json handler
  • php/api all API handlers (youtube/last.fm API)
  • php/util all other php libs
  • tmp temp folder for generated templates