| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef H_YOUTUBE_VIDEOSITE |
| 14 |
#define H_YOUTUBE_VIDEOSITE |
| 15 |
|
| 16 |
#include <smooth.h> |
| 17 |
#include <boca.h> |
| 18 |
|
| 19 |
using namespace smooth; |
| 20 |
using namespace smooth::GUI; |
| 21 |
|
| 22 |
using namespace BoCA; |
| 23 |
|
| 24 |
#include <smooth-js/v8.h> |
| 25 |
|
| 26 |
namespace BoCA |
| 27 |
{ |
| 28 |
class Metadata |
| 29 |
{ |
| 30 |
public: |
| 31 |
String title; |
| 32 |
String description; |
| 33 |
|
| 34 |
String date; |
| 35 |
String thumbnail; |
| 36 |
|
| 37 |
String uploader; |
| 38 |
}; |
| 39 |
|
| 40 |
class VideoSite |
| 41 |
{ |
| 42 |
private: |
| 43 |
static String ReplaceInnerHTML(const String &); |
| 44 |
|
| 45 |
String name; |
| 46 |
String version; |
| 47 |
|
| 48 |
Array<String> decoders; |
| 49 |
|
| 50 |
String script; |
| 51 |
|
| 52 |
v8::Isolate *isolate; |
| 53 |
v8::Persistent<v8::Context> context; |
| 54 |
|
| 55 |
Bool CreateScriptContext(); |
| 56 |
Bool DestroyScriptContext(); |
| 57 |
|
| 58 |
Int ParseXML(const String &); |
| 59 |
public: |
| 60 |
VideoSite(const String &); |
| 61 |
~VideoSite(); |
| 62 |
|
| 63 |
Bool IsSane(); |
| 64 |
|
| 65 |
Bool CanHandleURL(const String &); |
| 66 |
|
| 67 |
String GetVideoURL(const String &); |
| 68 |
String GetDecoderID(const String &); |
| 69 |
|
| 70 |
Metadata QueryMetadata(const String &); |
| 71 |
accessors: |
| 72 |
const String &GetName() const { return name; } |
| 73 |
const String &GetVersion() const { return version; } |
| 74 |
|
| 75 |
const Array<String> &GetDecoders() const { return decoders; } |
| 76 |
}; |
| 77 |
}; |
| 78 |
|
| 79 |
#endif |