Windows Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 28 August 2011

How To: Create Extensions for Smooth YouTube Downloader

Posted on 04:20 by Unknown

Overview:
This page is for Developers who would like to create an Extension for Smooth YouTube Downloader, to support Searching and Downloading from Sites other than YouTube


Warning: Sites which contain adult content will not be supported nor included in the application !


How To:
The way extensions work is very straight forward, all you need to do is Create a class which Implements an Interface with few functions, then copy the resulting assembly to "Extensions" folder in "\Program Files\SmoothYTDownloader\Extensions" directory on device along (for a normal default installation) with the XML that defines the FileName of the assembly along with the Class FullName.


Stary by downloading this sample project, which contains The Source Code for "DailyMotion" Extension


Now I'll explain each method in the Interface and when it's called:


public interface IDownloadService

{

string DeveloperNotes { get; }

string Name { get; }

int SearchItemHeight { get; }

int SearchItemSelectedHeight { get; }

List<VideoFormat> GetAvailableFormats(VideoInfo videoInfo);

string GetUniqueName(VideoInfo videoInfo);

string GetVideoUrl(VideoInfo videoInfo);

void OnFormatSelected(VideoInfo videoInfo, VideoFormat selectedFormat);

List<VideoInfo> Search(string searchText, int currentPage, int maxResult);

}


  • string DeveloperNotes { get; }


This will be displayed for users, when they click on "Show Developer Notes" in the "Download Service" selection screen, just in case there are some special cases in your Extension.





  • string Name { get; }


Name of Download Service, which will be Displayed in the "Download Service" selection screen




  • int SearchItemHeight { get; }


Normal item height in Search screen, this value usually depends on the height of thumbnails for the site.
  • int SearchItemSelectedHeight { get; }


Height of search item on selection, which will also Display the Duration of the video, so make sure to leave a space for that below the Thumbnail image.


  • List<VideoInfo> Search(string searchText, int currentPage, int maxResult);


This is the first main function, it's called when a user enters text in the search screen box, and hits Search.
It returns a list of VideoInfo objects, which will be passed later to other functions.
VideoInfo class can be found in the WassimK.Utils assembly, found in the sample project along with the Interface to implement.


For this function, you need to provide values for:
VideoInfo.Title // Title to be displayed in Search results
VideoInfo.Duration // Video Duration
videoInfo.ImageUrls // Urls for Thumbnails


And you can also save some values using:
VideoInfo["Key"] = "Value";
Usually you need to store video ID in this stage.


Parameters:
  1. currentPage: This value starts with 1 and is incremented every time the user hits, "Show More..." in search results, so the Search function should return the next set of Search Results depending on this value.


  2. maxResult: Maximum number of search results per search page.






  • List<VideoFormat> GetAvailableFormats(VideoInfo videoInfo);


This function is called when a user selects an item from Search Results.


videoInfo is the same object returned previously from the Search function above.


Depending on information stored in videoInfo object, you should be able to return a list of formats/qualities supported by selected video.


VideoFormat class has 3 properties that need to be set:
  1. ItemText: Text to Display in the list of Formats screen


  2. Value: Any hidden value developer decides to save and use later to help get the video URL.


  3. Url: This URL is only used to support "Copy Url" functionality, if left empty, the user will see a messagebox saying, "this video doesn't support copy url"


Bear in mind that this videoFormat object will be passed later to the OnFormatSelected function, to help get the correct video Url.




  • void OnFormatSelected(VideoInfo videoInfo, VideoFormat selectedFormat);

This function is called when the user select a format from the Formats Selection Screen.
selectedFormat object contains information saved previously in the GetAvailableFormats function.
Usually in this function, you need to store information in the videoInfo object, which will be passed later to GetVideoUrl function.
The information you need to save is the what will help you get the video url for the selected format.
  • string GetVideoUrl(VideoInfo videoInfo);

This function is called in two situations, when a user selects a format for the list of formats, or the application needs to continue a previously paused Download.
To resume downloads, VideoInfo object is serialized on application exit, and deserialized when the application is launched again, the object is then passed to this function to get the video url and continue downloading.
Important Note: Never store the URL in the videoInfo object, because most of sites copy the video to a cache server and sometimes this cache is cleaned up and the URL is not available anymore, always use the video ID along with other information, like Video format saved in the videoInfo object to get the video Url


  • string GetUniqueName(VideoInfo videoInfo);


This function is called whenever a user select a format from the format screen, it checks if a download of this particular video and format is in progress already.





Usually, (videoInfo["ID"] + videoInfo["Format"]) is unique enough for each video.


XML file:
To be able to add your extension to the "Download Services" page you must include both the assembly and an XML file that defines the Download Service to the Root of Extensions folder

The format if the XML file is as follows:
<Service>

<Assembly FileName="WassimK.DailyMotionService.dll" />

<Class FullName="WassimK.SmoothYouTubeDownloader.Services.DailyMotionService" />

</Service>
It's straight forward, just one note Class FullName is the "NameSpace.ClassName"
Finally:
This was a very fast explanation and it's a bit ugly to be honest, but I hope it helps some of you, I believe the sample project code should cover most things in detail, if you have any questions or suggestions to improve the API, don't hesitate to write a comment here.

If you'd like your extension to be tested and included in next release, please email it to me, wassim.khalil9@gmail.com
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Service Bus Topic - Automatic forward messages from a subscription to a topic
    Windows Azure Service Bus Topic is a service that enables us to distribute the same messages to different consumers without having to know e...
  • CDN is not the only solution to improve the page speed - Reverse Caching Proxy
    I heard more and more often think like this: “If your website is to slow, you should use a CDN.” Great, CDN is THE solution for any kind of ...
  • Content Types - Level 6: Rich Media
    Level 6: Rich Media NOTE: This is part 7 of 7 and the conclusion of this continuing series; please see earlier posts for more background inf...
  • Publishing our CellCast Widget for iPad
    The rush has been on this week as our development team worked to design a new version of our CellCast Widget specifically for Apple's up...
  • Patterns in Windows Azure Service Bus - Message Splitter Pattern
    In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an a...
  • E-Learning Vendors Attempt to Morph Mobile
    The sign should read: " Don't touch! Wet Paint !" I had a good chuckle today after receiving my latest emailed copy of the eLe...
  • SQL - UNION and UNION ALL
    I think that all of us used until now UNION in a SQLstatement. Using this operator we can combine the result of 2 queries. For example we wa...
  • Cum sa salvezi un stream direct intr-un fisier
    Cred ca este a 2-a oara cĆ¢nd Ć®ntĆ¢lnesc aceasta cerința in decurs de cĆ¢teva săptămĆ¢ni. Se da un stream și o locație unde trebuie salvat, se c...
  • Task.Yield(...), Task.Delay(...)
    I think that a lot of person already heard about these new methods. In this post I want to clarify some things about these new methods that ...
  • Content Types - Level 4: Reference
    Level 4: Reference Materials & Static Content NOTE: This is part 5 of 7 in a continuing series; please see earlier posts for more backgr...

Categories

  • .NET
  • .NET nice to have
  • #if DEBUG
  • 15 iunie 2011
  • 15 octombrie 2011
  • 2011
  • abstracta
  • action
  • adaugare
  • ajax
  • Amsterdam
  • Android
  • aplicatii
  • App Fabric
  • Apple iSlate
  • array
  • as
  • ASP.NET
  • AsReadOnly
  • Assembly comun
  • async
  • Asynchronous programming
  • asyncron
  • Autofac
  • AutoMapper
  • az
  • Azure
  • Azure AppFabric Cache
  • Azure backup solution
  • Azure Storage Explorer
  • azure. cloud
  • backup
  • BCP utility
  • bing maps v7
  • BitArray
  • BlackBerry
  • blob
  • BlobContainerPublicAccessType
  • breakpoint
  • bucuresti
  • C#
  • cache
  • CallerMemberName
  • CellCast
  • Certificate
  • CES
  • change
  • ChannelFactory
  • clasa
  • classinitialize
  • clean code
  • click event
  • close
  • Cloud
  • Cluj
  • cluj-napoca
  • Code contracts
  • code retrat
  • codecamp
  • CollectionAssert
  • Compact Edition
  • compara
  • Comparer T .Default
  • CompareTo
  • comparison
  • comunitate
  • concurs
  • Conditional attribute
  • configurare
  • connection string
  • container
  • content type
  • control
  • Convert
  • convertAll
  • convertor
  • cross platform
  • CRUD
  • css
  • custom properties
  • custom request
  • DACPAC
  • Daniel Andres
  • data sync service
  • database
  • date time
  • datetime
  • debug
  • default
  • delegate
  • dependency injection
  • deploy
  • DeploymentItem
  • design patterns
  • Dev de Amsterdam
  • development stoage
  • dictionary
  • diferente
  • digging
  • director
  • Directory.Exist
  • disable
  • dispatcher
  • dispose
  • dropdown
  • dynamic
  • EF
  • email
  • encoding
  • entity framework
  • enum
  • enumerable
  • Environment.NewLine
  • error
  • error 404
  • error handling
  • eveniment
  • event
  • ews
  • excel
  • exception
  • exchange
  • exita
  • explicit
  • export
  • extension
  • field
  • File.Exist
  • finalize
  • fire and forget
  • Fluent interface pattern
  • format
  • func
  • GC.SuppressFinalize
  • generic
  • getdirectoryname
  • globalization
  • gmail
  • hackathon
  • Hadoop
  • handle
  • HTML
  • html 5
  • Html.ActionLink
  • http://www.blogger.com/img/blank.gif
  • HttpModule
  • IComparable
  • IE
  • ienumerable
  • IIS
  • image
  • implicit
  • import
  • int
  • internationalization
  • Internet Explorer
  • interop
  • Ioc
  • IP Filter
  • iPhone
  • iQuest
  • IStructuralEquatable
  • ITCamp
  • itspark
  • java script
  • javascript
  • July 2012
  • KeyedByTypeCollection
  • KeyNotFoundException
  • Kinect SDK
  • lambda expression
  • LightSwitch Microsoft Silverlight
  • linq
  • list
  • lista
  • lista servicii
  • liste
  • Live Connect
  • Live ID
  • load
  • localization
  • lock
  • m-learning
  • MAC
  • Mango
  • map
  • mapare
  • mapare propietati
  • messagequeue
  • meta properties
  • method
  • MethodImpl
  • Metro App
  • Microsoft
  • Microsoft Sync Framework
  • mlearning
  • mlearning devices
  • Mobile Apps
  • mobile in the cloud
  • mobile learning
  • mobile services
  • Mobile Web
  • mongoDb
  • monitorizare
  • msmq
  • multitasking
  • MVC
  • MVC 3
  • MVVM
  • namespace
  • nextpartitionkey
  • nextrowkey
  • Ninject
  • nivel acces
  • no result
  • normalize
  • nosql
  • null expcetion
  • null object pattern
  • NullReferenceException
  • OAuth API
  • office
  • offline
  • Open ID
  • openhackeu2011
  • operations
  • operator
  • optimization
  • option
  • outputcache
  • OutputCacheProvider
  • override
  • paginare
  • pagination
  • path
  • persistare
  • Portable Library tool
  • Post event – CodeCamp Cluj-Napoca
  • predicate
  • predictions
  • prezentare
  • process
  • proiect
  • property
  • propietati
  • query
  • ReadOnlyCollection
  • ReadOnlyDictionary
  • referinta
  • reflection
  • remote
  • reply command
  • request
  • request response
  • resouce
  • REST
  • REST Client
  • RESTSharp
  • ronua
  • rss
  • rulare
  • salvare in fisier
  • sc
  • schimbare timp
  • select
  • select nodes
  • send
  • serializare
  • serialization
  • Server.Transfer. Resposen.Redirect
  • service bus
  • ServiceBase
  • servicecontroller
  • sesiune
  • session
  • Session_End
  • Session_Start
  • setup
  • Sibiu
  • signalR
  • Silverlight
  • sincronizare
  • Single Responsibility Principle
  • SkyDrive
  • skype
  • smartphones
  • smtp
  • Snapguide
  • sniffer
  • socket
  • solid
  • spec#
  • sql
  • Sql Azure
  • SQL CE
  • sql server 2008 RC
  • SRP
  • startuptype
  • stateful
  • stateless
  • static
  • stergere
  • store
  • store procedure
  • stream
  • string
  • string.join
  • struct
  • StructuralEqualityComparer
  • submit
  • switch
  • Symbian
  • Synchronized
  • system
  • tabele
  • table
  • techEd 2012
  • tempdata
  • test
  • testcleanup
  • testinitialize
  • testmethod
  • thread
  • timer
  • ToLower
  • tool
  • tostring
  • Total Cost Calculator
  • trace ASP.NET
  • transcoding
  • tuplu
  • tutorial
  • TWmLearning
  • type
  • unit test
  • unittest
  • UrlParameter.Optional
  • Validate
  • validation
  • verificare
  • video
  • view
  • ViewBag
  • virtual
  • visual studio
  • VM role
  • Vunvulea Radu
  • wallpaper
  • WCF
  • WebBrower
  • WebRequest
  • where clause
  • Windows
  • windows 8
  • Windows Azure
  • Windows Azure Service Management CmdLets
  • windows live messenger
  • Windows Mobile
  • Windows Phone
  • windows service
  • windows store application
  • Windows Task
  • WinRT
  • word
  • workaround
  • XBox
  • xml
  • xmlns
  • XNA
  • xpath
  • YMesseger
  • Yonder
  • Zip

Blog Archive

  • ►  2013 (139)
    • ►  November (17)
    • ►  October (12)
    • ►  September (10)
    • ►  August (7)
    • ►  July (8)
    • ►  June (15)
    • ►  May (12)
    • ►  April (17)
    • ►  March (16)
    • ►  February (9)
    • ►  January (16)
  • ►  2012 (251)
    • ►  December (9)
    • ►  November (19)
    • ►  October (26)
    • ►  September (13)
    • ►  August (35)
    • ►  July (28)
    • ►  June (27)
    • ►  May (24)
    • ►  April (18)
    • ►  March (17)
    • ►  February (20)
    • ►  January (15)
  • ▼  2011 (127)
    • ►  December (11)
    • ►  November (20)
    • ►  October (8)
    • ►  September (8)
    • ▼  August (8)
      • How To: Create Themes for Smooth YouTube Downloader
      • How To: Create Extensions for Smooth YouTube Downl...
      • TinyUrl for Windows Mobile
      • [NEW VERSION 3.0] Smooth YouTube Downloader for Wi...
      • Ioc - Autofac
      • Silverlight - Diferente intre MAC OS si Windows OS.
      • Ioc -Ninject
      • (3) How to use Office in Silverlight applications
    • ►  July (10)
    • ►  June (5)
    • ►  May (8)
    • ►  April (9)
    • ►  March (14)
    • ►  February (20)
    • ►  January (6)
  • ►  2010 (26)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (1)
    • ►  February (1)
    • ►  January (14)
Powered by Blogger.

About Me

Unknown
View my complete profile