Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Anghami #120

Merged
merged 4 commits into from
Sep 22, 2017
Merged

Anghami #120

merged 4 commits into from
Sep 22, 2017

Conversation

mahmoudhossam
Copy link
Contributor

This adds support for Anghami, a music streaming service in the MENA region.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.784% when pulling f8f2380 on mahmoudhossam:anghami into 45a0d70 on ColinDuquesnoy:develop.

Copy link
Owner

@ColinDuquesnoy ColinDuquesnoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I have a left a few code review comments.

It would also be nice if you could adapt the logo to match the style used in the application (grey circle with white foreground).

author_website=http://mahmoudhossam.com
icon=anghami-logo.png
name=Anghami
require_proprietary_codecs=false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that service does not require proprietary codecs? On which platform did you tested it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on Vivaldi on Arch Linux, without the widevine plugin.

Is there a way to be sure it doesn't require any proprietary codecs?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ffmpeg is the package that provides the proprietary codecs but you won't be able to remove it easily as it will also remove qtwebengine (and many other packages...)

I'd suggest to run your plugin from the MellowPlayer AppImage (the AppImage should find your plugin automatically).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ColinDuquesnoy I'll check out the AppImage, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ColinDuquesnoy I tried the AppImage and it didn't play apparently because pepper flash is required.

Is that considered a proprietary codec?

There's nothing much on this topic in the documentation, and other services don't seem to have this flag set at all.

Copy link
Owner

@ColinDuquesnoy ColinDuquesnoy Sep 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two cases to consider:

  1. the service uses flash. In that case, yes, flash will provide the proprietary codecs. This is not an issue on most platforms because you just need to install pepper flash plugin (it will work from an AppImage). On ArchLinux, just install pepper-flash

  2. The service use HTML 5 audio/video capabilities. In that case, proprietary codecs are provided by ffmpeg. It will not work in an AppImage (and on Windows and OSX) because QtWebEngine statically links with a version of ffmpeg compiled without proprietary codecs support (for licensing reasons).

There is a bit of documentation about that in the readme and on the qtwebengine documentation. Apparently there is not enough documentation so I will include a section that talk about that in the developer documentation.

other services don't seem to have this flag set at all.

Mixcloud, soundcloud and spotify plugins set this flag to true (in the master branch). On the develop branch, I replaced this flag by a list of supported platforms to avoid confusion (for end users). See #115.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ColinDuquesnoy I have pepper-flash installed on Arch Linux and the AppImage still does not play.

I get this warning in the AppImage output though:

[WARNING:flash/platform/pepper/pep_module.cpp(63)] SANDBOXED

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so most likely the service needs codecs from ffmpeg (I assume the service works with the mellowplayer AUR package).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about the flag. I'll set it up myself.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about the flag. I'll set it up myself.

"volume": 1,
"duration": 0,
"position": 0,
"songId": 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

songId must be set. You can use the below method to generate a unique id based on the song title:

function getHashCode(s) {
    return s.split("").reduce(function(a, b) {
        a = ((a << 5) - a) + b.charCodeAt(0);
        return a & a
    }, 0);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out what songID is just by looking at the documentation, can you please make it more clear like this comment? thanks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, the documentation is not clear. I've updated it. Thank you for the feedback!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ColinDuquesnoy You're welcome.

"canGoPrevious": true,
"canAddToFavorites": false,
"volume": 1,
"duration": 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you cannot get song duration and position? It is easy to convert a duration string to a number of seconds using the below function:

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
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anghami prints elapsed and remaining time only, so I think I can get the position easily, but the duration is going to need a bit of work.

Player shown below

image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a similar thing for Mixcloud. I just added the elapsed time to the remaining time to get the duration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ColinDuquesnoy Okay, I'll do that then.

@ColinDuquesnoy ColinDuquesnoy added this to the 3.1 milestone Sep 20, 2017
@mahmoudhossam
Copy link
Contributor Author

@ColinDuquesnoy I'll work on the comments when I get home, but I don't think I'll be able to do the logo thing because I'm not that good with GIMP unfortunately.

@ColinDuquesnoy
Copy link
Owner

I don't think I'll be able to do the logo thing because I'm not that good with GIMP unfortunately.

Ok that's not a big deal. I'll ask @CelineThiry to adapt the icon.

@mahmoudhossam
Copy link
Contributor Author

@ColinDuquesnoy I think I addressed all the issues with the integration script, take a look.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 92.81% when pulling 269e50b on mahmoudhossam:anghami into 45a0d70 on ColinDuquesnoy:develop.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 92.81% when pulling 1fae462 on mahmoudhossam:anghami into 45a0d70 on ColinDuquesnoy:develop.

@ColinDuquesnoy ColinDuquesnoy merged commit 151d948 into ColinDuquesnoy:develop Sep 22, 2017
@ColinDuquesnoy
Copy link
Owner

Thank you!

@mahmoudhossam mahmoudhossam deleted the anghami branch September 22, 2017 13:04
@cpjeanpaul cpjeanpaul mentioned this pull request Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants