Add support to sharing from Arte's video to Kodi (#736)
* Add support to sharing from Arte video (The European Culture Channel) to Kodi * Handle Arte's video (The European Culture Channel)
This commit is contained in:
parent
74ef717a37
commit
a9a833ddfe
|
@ -1,6 +1,10 @@
|
||||||
Changelog
|
Changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
Version 2.5.1
|
||||||
|
-------------
|
||||||
|
- Add support to sharing from Arte video (The European Culture Channel) to Kodi
|
||||||
|
|
||||||
Version 2.5.0
|
Version 2.5.0
|
||||||
-------------
|
-------------
|
||||||
- Include search option in PVR section
|
- Include search option in PVR section
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<data android:host="www.svtplay.se"/>
|
<data android:host="www.svtplay.se"/>
|
||||||
<data android:host="soundcloud.com"/>
|
<data android:host="soundcloud.com"/>
|
||||||
<data android:host="m.soundcloud.com"/>
|
<data android:host="m.soundcloud.com"/>
|
||||||
|
<data android:host="www.arte.tv"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data android:name="android.service.chooser.chooser_target_service"
|
<meta-data android:name="android.service.chooser.chooser_target_service"
|
||||||
|
@ -128,6 +129,7 @@
|
||||||
<data android:host="www.svtplay.se"/>
|
<data android:host="www.svtplay.se"/>
|
||||||
<data android:host="soundcloud.com"/>
|
<data android:host="soundcloud.com"/>
|
||||||
<data android:host="m.soundcloud.com"/>
|
<data android:host="m.soundcloud.com"/>
|
||||||
|
<data android:host="www.arte.tv"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.xbmc.kore.utils.LogUtils;
|
||||||
import org.xbmc.kore.utils.TabsAdapter;
|
import org.xbmc.kore.utils.TabsAdapter;
|
||||||
import org.xbmc.kore.utils.UIUtils;
|
import org.xbmc.kore.utils.UIUtils;
|
||||||
import org.xbmc.kore.utils.Utils;
|
import org.xbmc.kore.utils.Utils;
|
||||||
|
import org.xbmc.kore.utils.PluginUrlUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
@ -623,6 +624,8 @@ public class RemoteActivity extends BaseActivity
|
||||||
String gti = amazonMatcher.group(1);
|
String gti = amazonMatcher.group(1);
|
||||||
return "plugin://plugin.video.amazon-test/?asin=" + gti + "&mode=PlayVideo&adult=0&name=&trailer=0&selbitrate=0";
|
return "plugin://plugin.video.amazon-test/?asin=" + gti + "&mode=PlayVideo&adult=0&name=&trailer=0&selbitrate=0";
|
||||||
}
|
}
|
||||||
|
} else if (PluginUrlUtils.isHostArte(host)) {
|
||||||
|
return PluginUrlUtils.toPluginUrlArte(playuri);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2020 STB Land. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.xbmc.kore.utils;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Misc util methods for use with plugin URL
|
||||||
|
*/
|
||||||
|
public class PluginUrlUtils {
|
||||||
|
|
||||||
|
public static boolean isHostArte(String host) {
|
||||||
|
return host.equals("www.arte.tv");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toPluginUrlArte(Uri playUri) {
|
||||||
|
Pattern pattern = Pattern.compile("^https://www.arte.tv/[a-z]{2}/videos/([0-9]{6}-[0-9]{3}-[A-Z])/.*$");
|
||||||
|
Matcher matcher = pattern.matcher(playUri.toString());
|
||||||
|
if (matcher.matches()) {
|
||||||
|
String kind="SHOW";
|
||||||
|
String program_id=matcher.group(1);
|
||||||
|
return "plugin://plugin.video.arteplussept/play/" + kind + "/" + program_id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Martijn Brekhof. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.xbmc.kore.utils;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
import static junit.framework.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@Config(sdk = 28)
|
||||||
|
public class PluginUrlUtilsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isHostArte() throws Exception {
|
||||||
|
assertTrue(PluginUrlUtils.isHostArte("www.arte.tv"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void toPluginUrlArte() throws Exception {
|
||||||
|
Uri playUri = Uri.parse("https://www.arte.tv/fr/videos/084692-000-A/mongolie-le-reve-d-une-jeune-nomade/");
|
||||||
|
String pluginUrl = PluginUrlUtils.toPluginUrlArte(playUri);
|
||||||
|
assertNotNull(pluginUrl);
|
||||||
|
assertEquals("plugin://plugin.video.arteplussept/play/SHOW/084692-000-A", pluginUrl);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue