-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4d27ad
commit caa62fa
Showing
11 changed files
with
194 additions
and
34 deletions.
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
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
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
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
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
29 changes: 29 additions & 0 deletions
29
library/src/main/java/com/gapps/library/api/models/api/UltimediaVideoInfoModel.kt
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,29 @@ | ||
package com.gapps.library.api.models.api | ||
|
||
import com.gapps.library.api.FORMAT | ||
import com.gapps.library.api.FORMAT_JSON | ||
import com.gapps.library.api.URL | ||
import com.gapps.library.api.models.api.base.VideoInfoModel | ||
import com.gapps.library.api.models.video.ultimedia.UltimediaResponse | ||
|
||
class UltimediaVideoInfoModel: VideoInfoModel<UltimediaResponse>() { | ||
override val baseUrl: String | ||
get() = "https://www.ultimedia.com" | ||
//https://regex101.com/r/2AsrOc/1 | ||
override val pattern: String | ||
get() = "(?:http[s]?:\\/\\/)?(?:www)?\\.?ultimedia\\.com\\/(?:deliver|default|api)\\/.*\\/([_a-zA-Z0-9]+)\\S*" | ||
override val idPattern: String | ||
get() = pattern | ||
override val type: Class<UltimediaResponse> | ||
get() = UltimediaResponse::class.java | ||
override val hostingName: String | ||
get() = "Ultimedia" | ||
|
||
override fun getInfoUrl(incomingUrl: String?): String? { | ||
return "$baseUrl/api/search/oembed?$FORMAT=$FORMAT_JSON&$URL=$incomingUrl" | ||
} | ||
|
||
override fun getPlayLink(videoId: String): String { | ||
return "https://www.ultimedia.com/deliver/generic/iframe/src/$videoId/" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
library/src/main/java/com/gapps/library/api/models/video/ultimedia/UltimediaResponse.kt
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,44 @@ | ||
package com.gapps.library.api.models.video.ultimedia | ||
|
||
|
||
import com.gapps.library.api.models.video.VideoPreviewModel | ||
import com.gapps.library.api.models.video.base.BaseVideoResponse | ||
import com.google.gson.annotations.SerializedName | ||
|
||
data class UltimediaResponse( | ||
@SerializedName("version") | ||
val version: String = "", | ||
@SerializedName("type") | ||
val type: String = "", | ||
@SerializedName("title") | ||
val title: String = "", | ||
@SerializedName("description") | ||
val description: String = "", | ||
@SerializedName("html") | ||
val html: String = "", | ||
@SerializedName("width") | ||
val width: String = "", | ||
@SerializedName("height") | ||
val height: String = "", | ||
@SerializedName("thumbnail_url") | ||
val thumbnailUrl: String = "", | ||
@SerializedName("thumbnail_width") | ||
val thumbnailWidth: String = "", | ||
@SerializedName("thumbnail_height") | ||
val thumbnailHeight: String = "", | ||
@SerializedName("provider_name") | ||
val providerName: String = "", | ||
@SerializedName("provider_url") | ||
val providerUrl: String = "", | ||
@SerializedName("author_name") | ||
val authorName: String = "" | ||
): BaseVideoResponse{ | ||
override fun toPreview(url: String?, linkToPlay: String, hostingName: String, videoId: String): VideoPreviewModel { | ||
return VideoPreviewModel(url, linkToPlay, hostingName, videoId).apply { | ||
this.thumbnailUrl = this@UltimediaResponse.thumbnailUrl | ||
this.videoTitle = this@UltimediaResponse.authorName | ||
this.width = this@UltimediaResponse.width.toInt() | ||
this.height = this@UltimediaResponse.height.toInt() | ||
} | ||
} | ||
} |
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
Oops, something went wrong.