This repository has been archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial support for Anghami * Add myself to AUTHORS * Add song position, duration and id to Anghami * Address Anghami integration script errors
- Loading branch information
1 parent
27b87d1
commit 151d948
Showing
5 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
var playbackStatus = mellowplayer.PlaybackStatus.STOPPED; | ||
|
||
function update() { | ||
return { | ||
"playbackStatus": playbackStatus, | ||
"canSeek": false, | ||
"canGoNext": true, | ||
"canGoPrevious": true, | ||
"canAddToFavorites": false, | ||
"volume": 1, | ||
"duration": getDuration(), | ||
"position": getPosition(), | ||
"songId": getSongId(), | ||
"songTitle": getTitle(), | ||
"artistName": getArtist(), | ||
"albumTitle": '', | ||
"artUrl": getAlbumArt(), | ||
"isFavorite": false | ||
}; | ||
} | ||
|
||
function toSeconds(string) { | ||
try { | ||
var dtimes = string.split(":"); | ||
var dminutes = dtimes[0]; | ||
var dseconds = dtimes[1]; | ||
var duration = parseInt(dseconds, 10) + (parseInt(dminutes, 10) * 60); | ||
} catch (e) { | ||
var duration = 0; | ||
} | ||
return duration | ||
} | ||
|
||
function getHashCode(s) { | ||
return s.split("").reduce(function(a, b) { | ||
a = ((a << 5) - a) + b.charCodeAt(0); | ||
return a & a | ||
}, 0); | ||
} | ||
|
||
function getDuration() { | ||
var remaining = $('#player .duration')[0]; | ||
var position = $('#player .position')[0]; | ||
if (remaining === undefined || position === undefined) { | ||
return 0 | ||
} | ||
return toSeconds(remaining.innerText.substr(2)) + toSeconds(position.innerText) | ||
} | ||
|
||
function getPosition() { | ||
var position = $('#player .position')[0]; | ||
if (position === undefined) { | ||
return 0 | ||
} | ||
return toSeconds(position.innerText) | ||
} | ||
|
||
function getSongId() { | ||
var title = getTitle(); | ||
if (title === undefined) { | ||
return 0 | ||
} | ||
return getHashCode(title); | ||
} | ||
|
||
function getAlbumArt() { | ||
var albumArt = $('.cover-art img')[0]; | ||
if (albumArt === undefined) { | ||
return '' | ||
} | ||
return albumArt.attributes.src.value | ||
} | ||
|
||
function getTitle() { | ||
var title = $('#player .track-title a')[0]; | ||
if (title === undefined) { | ||
return '' | ||
} | ||
return title.innerText | ||
} | ||
|
||
function getArtist() { | ||
var artist = $('#player .track-artist')[0]; | ||
if (artist === undefined) { | ||
return '' | ||
} | ||
return artist.innerText | ||
} | ||
|
||
function play() { | ||
$('#player .icon-play').click(); | ||
playbackStatus = mellowplayer.PlaybackStatus.PLAYING; | ||
} | ||
|
||
function pause() { | ||
$('#player .icon-pause-2').click(); | ||
playbackStatus = mellowplayer.PlaybackStatus.PAUSED; | ||
} | ||
|
||
function goNext() { | ||
$('#player .icon-next-1').click(); | ||
} | ||
|
||
function goPrevious() { | ||
$('#player .icon-previous-1').click(); | ||
} | ||
|
||
function setVolume(volume) { | ||
|
||
} | ||
|
||
function addToFavorites() { | ||
|
||
} | ||
|
||
function removeFromFavorites() { | ||
|
||
} | ||
|
||
function seekToPosition(position) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
author=Mahmoud Hossam | ||
author_website=http://mahmoudhossam.com | ||
icon=anghami-logo.png | ||
name=Anghami | ||
require_proprietary_codecs=false | ||
url=https://www.anghami.com/ | ||
version=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"accent": "#ffc107", | ||
"background": "#ffffff", | ||
"foreground": "#505050", | ||
"primary": "#5f81d4", | ||
"primaryForeground": "#ffffff", | ||
"secondary": "#5f81d4", | ||
"secondaryForeground": "#ffffff" | ||
} |