mirror of
https://github.com/videolan/vlc-android
synced 2024-11-23 18:05:36 +08:00
Clean obsolete subtitle downloader code
This commit is contained in:
parent
cba5d3ead4
commit
520cb0bb43
@ -25,8 +25,6 @@ import androidx.core.net.toUri
|
||||
import org.videolan.libvlc.interfaces.IMedia
|
||||
import org.videolan.resources.TYPE_LOCAL_FAV
|
||||
import org.videolan.resources.TYPE_NETWORK_FAV
|
||||
import org.videolan.resources.opensubtitles.OpenSubtitle
|
||||
import org.videolan.resources.opensubtitles.QueryParameters
|
||||
import org.videolan.vlc.gui.dialogs.State
|
||||
import org.videolan.vlc.gui.dialogs.SubtitleItem
|
||||
|
||||
@ -112,24 +110,4 @@ object TestUtil {
|
||||
movieReleaseName: String,
|
||||
zipDownloadLink: String): SubtitleItem = SubtitleItem(idSubtitle, mediaUri, subLanguageID, movieReleaseName, State.Downloading, zipDownloadLink)
|
||||
|
||||
fun createDownloadingSubtitleItem(
|
||||
idSubtitle: String,
|
||||
mediaPath: String,
|
||||
subLanguageID: String,
|
||||
movieReleaseName: String,
|
||||
zipDownloadLink: String): SubtitleItem = createDownloadingSubtitleItem(idSubtitle, mediaPath.toUri(), subLanguageID, movieReleaseName, zipDownloadLink)
|
||||
|
||||
fun createOpenSubtitle(
|
||||
idSubtitle: String,
|
||||
subLanguageID: String,
|
||||
movieReleaseName: String,
|
||||
zipDownloadLink: String) = OpenSubtitle(
|
||||
idSubtitle = idSubtitle, subLanguageID = subLanguageID, movieReleaseName = movieReleaseName, zipDownloadLink = zipDownloadLink,
|
||||
idMovie = "", idMovieImdb = "", idSubMovieFile = "", idSubtitleFile = "", infoFormat = "", infoOther = "", infoReleaseGroup = "",
|
||||
userID = "", iSO639 = "", movieFPS = "", languageName = "", subActualCD = "", subSumVotes = "", subAuthorComment = "", subComments = "",
|
||||
score = 0.0, seriesEpisode = "", seriesIMDBParent = "", seriesSeason = "", subAddDate = "", subAutoTranslation = "", subBad = "", subDownloadLink = "",
|
||||
subDownloadsCnt = "", subEncoding = "", subFeatured = "", subFileName = "", subForeignPartsOnly = "", subFormat = "", subFromTrusted = "", subHash = "",
|
||||
subHD = "", subHearingImpaired = "", subLastTS = "", subRating = "", subSize = "", subSumCD = "", subtitlesLink = "", subTranslator = "", subTSGroup = "",
|
||||
subTSGroupHash = "", movieByteSize = "", movieHash = "", movieTimeMS = "", queryParameters = QueryParameters("", "", ""), queryNumber = "",
|
||||
userNickName = "", userRank = "", matchedBy = "", movieImdbRating = "", movieKind = "", movieName = "", movieNameEng = "", movieYear = "")
|
||||
}
|
||||
|
@ -1,22 +1,10 @@
|
||||
package org.videolan.resources.opensubtitles
|
||||
|
||||
import org.videolan.resources.opensubtitles.OpenSubV1
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
|
||||
//Passing 0 for numbers and "" for strings ignores that parameters
|
||||
interface IOpenSubtitleService {
|
||||
// @GET("episode-{episode}/imdbid-{imdbId}/moviebytesize-{movieByteSize}/moviehash-{movieHash}/query-{name}/season-{season}/sublanguageid-{subLanguageId}/tag_{tag}")
|
||||
// suspend fun query( @Path("movieByteSize") movieByteSize: String = "",
|
||||
// @Path("movieHash") movieHash: String = "",
|
||||
// @Path("name") name: String = "",
|
||||
// @Path("imdbId") imdbId: String = "" ,
|
||||
// @Path("tag") tag: String = "",
|
||||
// @Path("episode") episode: Int = 0,
|
||||
// @Path("season") season: Int = 0,
|
||||
// @Path("subLanguageId") languageId: String = ""): List<OpenSubtitle>
|
||||
|
||||
|
||||
@GET("subtitles")
|
||||
suspend fun query(
|
||||
@Query("episode_number") episode: Int? = null,
|
||||
|
@ -1,68 +1,5 @@
|
||||
package org.videolan.resources.opensubtitles
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
|
||||
data class OpenSubtitle(
|
||||
@field:Json(name = "MatchedBy") val matchedBy: String,
|
||||
@field:Json(name = "IDSubMovieFile") val idSubMovieFile: String,
|
||||
@field:Json(name = "MovieHash") val movieHash: String,
|
||||
@field:Json(name = "MovieByteSize") val movieByteSize: String,
|
||||
@field:Json(name = "MovieTimeMS") val movieTimeMS: String,
|
||||
@field:Json(name = "IDSubtitleFile") val idSubtitleFile: String,
|
||||
@field:Json(name = "SubFileName") val subFileName: String,
|
||||
@field:Json(name = "SubActualCD") val subActualCD: String,
|
||||
@field:Json(name = "SubSize") val subSize: String,
|
||||
@field:Json(name = "SubHash") val subHash: String,
|
||||
@field:Json(name = "SubLastTS") val subLastTS: String,
|
||||
@field:Json(name = "SubTSGroup") val subTSGroup: String,
|
||||
@field:Json(name = "InfoReleaseGroup") val infoReleaseGroup: String,
|
||||
@field:Json(name = "InfoFormat") val infoFormat: String,
|
||||
@field:Json(name = "InfoOther") val infoOther: String,
|
||||
@field:Json(name = "IDSubtitle") val idSubtitle: String,
|
||||
@field:Json(name = "UserID") val userID: String,
|
||||
@field:Json(name = "SubLanguageID") val subLanguageID: String,
|
||||
@field:Json(name = "SubFormat") val subFormat: String,
|
||||
@field:Json(name = "SubSumCD") val subSumCD: String,
|
||||
@field:Json(name = "SubAuthorComment") val subAuthorComment: String,
|
||||
@field:Json(name = "SubAddDate") val subAddDate: String,
|
||||
@field:Json(name = "SubBad") val subBad: String,
|
||||
@field:Json(name = "SubRating") val subRating: String,
|
||||
@field:Json(name = "SubSumVotes") val subSumVotes: String,
|
||||
@field:Json(name = "SubDownloadsCnt") val subDownloadsCnt: String,
|
||||
@field:Json(name = "MovieReleaseName") val movieReleaseName: String,
|
||||
@field:Json(name = "MovieFPS") val movieFPS: String,
|
||||
@field:Json(name = "IDMovie") val idMovie: String,
|
||||
@field:Json(name = "IDMovieImdb") val idMovieImdb: String,
|
||||
@field:Json(name = "MovieName") val movieName: String,
|
||||
@field:Json(name = "MovieNameEng") val movieNameEng: Any,
|
||||
@field:Json(name = "MovieYear") val movieYear: String,
|
||||
@field:Json(name = "MovieImdbRating") val movieImdbRating: Any,
|
||||
@field:Json(name = "SubFeatured") val subFeatured: String,
|
||||
@field:Json(name = "UserNickName") val userNickName: String,
|
||||
@field:Json(name = "SubTranslator") val subTranslator: String,
|
||||
@field:Json(name = "ISO639") val iSO639: String,
|
||||
@field:Json(name = "LanguageName") val languageName: String,
|
||||
@field:Json(name = "SubComments") val subComments: String,
|
||||
@field:Json(name = "SubHearingImpaired") val subHearingImpaired: String,
|
||||
@field:Json(name = "UserRank") val userRank: String,
|
||||
@field:Json(name = "SeriesSeason") val seriesSeason: String,
|
||||
@field:Json(name = "SeriesEpisode") val seriesEpisode: String,
|
||||
@field:Json(name = "MovieKind") val movieKind: String,
|
||||
@field:Json(name = "SubHD") val subHD: String,
|
||||
@field:Json(name = "SeriesIMDBParent") val seriesIMDBParent: String,
|
||||
@field:Json(name = "SubEncoding") val subEncoding: String,
|
||||
@field:Json(name = "SubAutoTranslation") val subAutoTranslation: String,
|
||||
@field:Json(name = "SubForeignPartsOnly") val subForeignPartsOnly: String,
|
||||
@field:Json(name = "SubFromTrusted") val subFromTrusted: String,
|
||||
@field:Json(name = "QueryParameters") val queryParameters: QueryParameters,
|
||||
@field:Json(name = "SubTSGroupHash") val subTSGroupHash: String,
|
||||
@field:Json(name = "SubDownloadLink") val subDownloadLink: String,
|
||||
@field:Json(name = "ZipDownloadLink") val zipDownloadLink: String,
|
||||
@field:Json(name = "SubtitlesLink") val subtitlesLink: String,
|
||||
@field:Json(name = "QueryNumber") val queryNumber: String,
|
||||
@field:Json(name = "Score") val score: Double
|
||||
)
|
||||
|
||||
data class QueryParameters(
|
||||
@field:Json(name = "query") val query: String,
|
||||
|
@ -20,7 +20,6 @@ class OpenSubtitleRepository(private val openSubtitleService: IOpenSubtitleServi
|
||||
languageIds?.toSet()?.run { if (contains("") || isEmpty()) setOf("") else this }
|
||||
?: setOf("")
|
||||
return openSubtitleService.query(
|
||||
// movieByteSize = movieByteSize.toString(),
|
||||
movieHash = movieHash ?: "",
|
||||
languageId = actualLanguageIds.sorted().joinToString(","),
|
||||
hearingImpaired = if (hearingImpaired) "only" else "include"
|
||||
|
@ -3,7 +3,6 @@ package org.videolan.resources.opensubtitles
|
||||
import android.util.Log
|
||||
import com.moczul.ok2curl.CurlInterceptor
|
||||
import com.moczul.ok2curl.logger.Logger
|
||||
import com.squareup.moshi.Moshi
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
|
@ -16,7 +16,6 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.videolan.resources.opensubtitles.Data
|
||||
import org.videolan.resources.opensubtitles.OpenSubV1
|
||||
import org.videolan.resources.opensubtitles.OpenSubtitle
|
||||
import org.videolan.resources.opensubtitles.OpenSubtitleClient
|
||||
import org.videolan.resources.opensubtitles.OpenSubtitleRepository
|
||||
import org.videolan.resources.util.NoConnectivityException
|
||||
|
@ -10,7 +10,7 @@ import junit.framework.TestCase.assertEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.videolan.resources.opensubtitles.OpenSubtitleRepository
|
||||
import main.java.org.videolan.resources.opensubtitles.OpenSubtitleRepository
|
||||
import org.videolan.resources.util.NoConnectivityException
|
||||
import org.videolan.tools.FileUtils
|
||||
import org.videolan.vlc.BaseTest
|
||||
|
Loading…
Reference in New Issue
Block a user