First attempt to get at least the following issue fixed:

"Add user channel with an url like ustream.tv/channelname does not work".

Just pushed the first api calls and minor changes to offer the ability to add user channels.

Part of the implement the user api issue.

Comments

coredumperror’s picture

How does one create a "user" channel with a URL like this? My test channels' URLs look like http://www.ustream.tv/channel/channelname, not http://www.ustream.tv/channelname.

coredumperror’s picture

Upon further research, I've discovered that channels like this do exist (e.g. http://www.ustream.tv/rockefellerfoundation) but their channel name (rockefellerfoundation) does not return a result from the channel API (http://api.ustream.tv/html/channel/rockefellerfoundation/getInfo) nor the user API (http://api.ustream.tv/html/user/rockefellerfoundation/getInfo). I have no idea how to deal with that.

rob c’s picture

http://www.ustream.tv/creativelive
http://www.ustream.tv/salesforce
and so on are all Channels, but not all of them.

http://api.ustream.tv/html/user/phillipphillips/getInfo
http://www.ustream.tv/phillipphillips

Thats a user! And the api documentation is not complete and some calls don't even exist anymore / have changed. I'll push a small change, and then we'll test what's in git now, because it does work. The calls i've added work, the UserID call isn't even required (not used at this point, but i did test with it), but that's in the api docs somewhere, but we might need it later on, so i left it in.

And i know a lot more channels / people like this, journalists, talkshows, and so on.

coredumperror’s picture

So basically, the channelname in http://www.ustream.tv/channelname is either a channel, user, or neither; so we have to at least try to treat it like both channel and user. The API call will either succeed as one of the two, or we get a double failure and have to report that we couldn't parse the url.

Or, we could do something really crazy, and download the page at the parsed URL and try to scrape the HTML to find some kind of embed data. I don't think that'd work very well, though.

rob c’s picture

Yup, that's about it. (lets go with the first idea, see what i've coded, that's a last resort-something, still wondering how much of these channels exist, i guess the majority / what would be the best order.)

Note: Ustream is now using this type address actively, they are even redirecting to it from some older urls i noticed.

coredumperror’s picture

Note: Ustream is now using this type address actively, they are even redirecting to it from some older urls i noticed.

Oh that's just awful. Their API doesn't support the new thing they're pushing? Thanks for being a shitty company, UStream. </rant>

rob c’s picture

Indeed. (while they do run Drupal on the dev site)

I have this working on my test site now, looks good.

I'm back to my other new project, almost finished, but please test what's on the media: ustream git, cause it might need some polishing.

coredumperror’s picture

OK, I took a look at your latest changes, and made some tweaks. The situation with URLs that we can't parse should now be much more user-friendly.

rob c’s picture

Status: Needs review » Closed (fixed)

Ok, have reviewed your changes, looks good, will do a large test and commit some minor tweaks today/tomorrow, currently upgrading my media module demo site.

I've done some more work on the livestream.com and ... justin.tv modules, both in a working state now. Have to admit, only provider that has a couple api calls we really need it justin.tv, all others lack a couple basic functions, witness this topic. But i did learn a lot about how the media module works, the justin tv module is Really fast and i implemented cache, will try to do the same thing for Ustream asap.

rob c’s picture

@coredumperror

Can you take a look at the good old github? I pushed some bigger changes to the Handler, including the way we parse(). Like to know what you think about these changes before i push them to d.o. (+ maybe can use a bit of testing, but looking good on the demo site).

Also axed a lot of stuff we don't need / isn't working anyway at this moment and still thinking a bit about caching, cause that should not be to hard to implement. (and axed oembed to save some time, we can use the api.)

https://github.com/ClusterFCK/media_ustream

coredumperror’s picture

Checking out your changes, I have these questions:

Why did you collapse the iframe code in the media-ustream-video.tpl.php file? I separated each attribute onto its own line to make it readable.

In the Handler code, why are you using the REPLACE function in this sql query?

$result = db_query("SELECT fid FROM {file_managed} WHERE REPLACE(filename, ' ', '') = '$id'");

Might it be possible to do the reverse equivalent of that REPLACE function on the $id variable, and then use EntityFieldQuery like it's used in the below code block?

Other than that, it looks great. I tested it on my dev site, and it's fine. I submitted a few minor tweaks to github, and sent a pull request.

rob c’s picture

media-ustream-video.tpl.php
Yeah i did that, it's more the style i like, but we can always change it back. (and this is also the only place we do this i think in media-land)

REPLACE
http://www.ustream.tv/SouthwestFloridaEagleCam is saved as 'Southwest Florida Eagle Cam' (the title). That's a user channel again, not promoted, so i just try to see if a channel with such a name exists, most of the times this will work i figured, because Create LIVE is also liked as 'CreateLIVE'. (as an example)
If we do it the other way, we have to add spaces before all capitals on the id, fist letter excluded. What i do now is a lot easier i figured.

Great you like it, i've also implemented a 'test' cache functionality on the validId() function last night, i'll push my changes to github and merge your work when i'm done cleaning up.

coredumperror’s picture

The formatting in the template file isn't a big deal, so we can just keep it your way.

Thanks for explaining the REPLACE function. I had to look at the code again to finally understand what the whole deal was with that block, but I get it now.

rob c’s picture

Heh, i just changed it back yesterday. No worries and your welcome.

I just pushed my latest to github for a quick test and then i'll push it to d.o.
This last change implements cache for JSON queries, but i guess we need to rethink this a bit, because of to much duplicated code.

I believe we'r getting close to an alpha1!

rob c’s picture

Latest version pushed to d.o.

rob c’s picture

Assigned: rob c » Unassigned
Issue summary: View changes