Skip to content

Instantly share code, notes, and snippets.

@courville
courville / FileCoreLibrary.diff
Created January 18, 2024 14:31
realdebrid sardine webdav
diff --git a/src/com/archos/filecorelibrary/FileEditor.java b/src/com/archos/filecorelibrary/FileEditor.java
index d34a879..76d880b 100644
--- a/src/com/archos/filecorelibrary/FileEditor.java
+++ b/src/com/archos/filecorelibrary/FileEditor.java
@@ -52,6 +52,7 @@ public abstract class FileEditor {
public boolean rename(String newName) { return false; };
public boolean move(Uri uri) { return false; };
public abstract boolean exists();
+ public long length() throws Exception { return -1; }
@courville
courville / sardinetest.java
Created March 4, 2023 21:04
sardine cli empty ACES
package org.courville.sardinetest;
import com.github.sardine.*;
import java.io.IOException;
import java.util.List;
public class Main {
public static void main(String[] args) {
// arguments are: user password url
@courville
courville / watchupnext.sql
Created May 21, 2022 18:22
next episode in show and movie in collection to watch
-- next episode in show and movie in collection to watch
-- note: faster with union
WITH v AS
(SELECT video_online_id, scraper_name, m_coll_id, m_year, s_id, e_season, e_episode, MAX(archos_lasttimeplayed) AS archos_lasttimeplayed
FROM video WHERE (m_coll_id NOT NULL OR s_id NOT NULL) AND Archos_lastTimePlayed=0 AND archos_hiddenbyuser = 0 GROUP BY video_online_id),
l AS
(SELECT m_coll_id, s_id, MAX(e_season) AS e_season, max(e_episode) AS e_episode, MAX(archos_lasttimeplayed) AS archos_lasttimeplayed, MAX(m_year) AS m_year
FROM video WHERE Archos_lastTimePlayed!=0 AND (m_coll_id NOT NULL OR s_id NOT NULL) AND archos_hiddenbyuser = 0 GROUP BY m_coll_id, s_id, e_season LIMIT 100)
SELECT v.video_online_id, v.scraper_name, v.e_season, v.e_episode, l.archos_lasttimeplayed
@courville
courville / tmdb_genres.sh
Created February 26, 2021 14:55
list all tmdb genres traductions and output result as markdown table
#!/bin/sh
# API= your tmdb API key
# all lang except en
LANG=$(curl -s https://api.themoviedb.org/3/configuration/languages\?api_key=${API} | jq | grep iso_639_1 | sed 's/^.*"iso_639_1": "\([a-z][a-z]\).*$/\1/g' | grep -v en | sort -u)
for lang in $LANG
do
curl -s https://api.themoviedb.org/3/genre/movie/list\?api_key=${API}\&language=${lang} | jq | grep \"name\": | grep -v null | sed 's/^.*"name": "\([^"]*\)"/\1/g' > result-$lang
#!/bin/bash
[ ! -d "opus" ] && git clone https://github.com/xiph/opus.git
# latest cmake and ndk
CMAKE_PATH=$(ls -d ${ANDROID_HOME}/cmake/* | sort -V | tail -n 1)
echo CMAKE_PATH is ${CMAKE_PATH}
NDK_PATH=$(ls -d ${ANDROID_HOME}/ndk/* | sort -V | tail -n 1)
echo NDK_PATH is ${NDK_PATH}
#!/bin/sh
git clone https://github.com/xiph/opus.git
CMAKE_PATH=/opt/android-sdk/cmake/3.10.2.4988404
NDK_PATH=/opt/android-sdk/ndk/21.3.6528147
API_LEVEL=21
for ABI in armeabi-v7a arm64-v8a x86 x86_64
do
diff --git a/build.sh b/build.sh
index 817c996..c15891b 100755
--- a/build.sh
+++ b/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
while getopts "a:c:" opt; do
case $opt in
@courville
courville / TestScraper.java
Last active April 14, 2020 18:30
Test scraper code for Nova Video Player
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// TODO: add MoviePathMatcher
// TODO: add TvShowPathMatcher
@courville
courville / alertDialogForProgressDialog.java
Created March 27, 2020 08:09
simple AlertDialog fo replace ProgressDialog which is deprecated
private AlertDialog alertDialog = null;
private ProgressBar progressBar = null;
private TextView textView = null;
public void displaySimpleDialog(Context context, boolean isSpinner, String dialogText, int progress, int maxProgress) {
if (alertDialog == null) { // init part
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setOnCancelListener(dialog -> {
dialog.cancel();
// do cleaning stuff
@courville
courville / findModeId.java
Last active February 3, 2020 21:26
find display modeId that matches currentMode resolution and desired refreshRate
if (Build.VERSION.SDK_INT >= 23) {
Display.Mode[] supportedModes = d.getSupportedModes();
Display.Mode currentMode = d.getMode();
// calculate wantedFps
float wantedFps = (float) ((double) video.fpsRate / (double) video.fpsScale);
int wantedModeId = 0;
// find corresponding wantedModeId for wantedFps
for (int i = 0; i < supportedModes.length; i++) {
if (supportedModes[i].matches(currentMode.getPhysicalWidth(), currentMode.getPhysicalHeight(), wantedFps)) {
wantedModeId = supportedModes[i].getModeId();