Skip to content

Instantly share code, notes, and snippets.

@courville
courville / iso6391tolanguage.java
Created February 1, 2020 11:53
two letter ISO639-1 to language conversion
String language_iso_639_1 = "fr";
if (language_iso_639_1 != null) {
Locale locale = new Locale(language_iso_639_1);
String language = locale.getDisplayLanguage());
}
@courville
courville / smallqueries.java
Last active December 29, 2021 18:22
avoid SQLiteBlobTooBigException: Row too big to fit into CursorWindow
// run small queries
static final int WINDOW_SIZE = 1000;
Cursor cursor = getFileListCursor(PARAM_ALL, null);
final int numberOfRows = cursor.getCount();
cursor.close();
int index = 0;
int window = WINDOW_SIZE;
@courville
courville / m-cursorwindow.diff
Created January 3, 2020 07:53
fight Row too big to fit into CursorWindow
diff --git a/src/com/archos/mediascraper/AutoScrapeService.java b/src/com/archos/mediascraper/AutoScrapeService.java
index 256242c..4115703 100644
--- a/src/com/archos/mediascraper/AutoScrapeService.java
+++ b/src/com/archos/mediascraper/AutoScrapeService.java
@@ -22,8 +22,12 @@ import android.app.Service;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.database.AbstractWindowedCursor;
import android.database.ContentObserver;
@courville
courville / a-no_init_renderer.diff
Created December 13, 2019 14:06
avos: do not apply MediaCodec AR
diff --git a/external/android/libsfdec/sfdec_ndkmediacodec.cpp b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
index 57f6c7e..56752c0 100644
--- a/external/android/libsfdec/sfdec_ndkmediacodec.cpp
+++ b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
@@ -76,12 +76,12 @@ static int init_renderer(sfdec_priv_t *sfdec)
if (format != NULL) {
if (AMediaFormat_getInt32(format, "width", &width)) {
- LOG("width changed: %d -> %d", sfdec->width, width);
- sfdec->width = width;
@courville
courville / a.diff
Created December 12, 2019 08:50
attempt scale to fit with crop for good aspect ratio on amlogic
diff --git a/external/android/libsfdec/sfdec_ndkmediacodec.cpp b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
index 57f6c7e..6c14586 100644
--- a/external/android/libsfdec/sfdec_ndkmediacodec.cpp
+++ b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
@@ -19,7 +19,7 @@
#ifdef __ANDROID_API__
#undef __ANDROID_API__
-#define __ANDROID_API__ 21
+#define __ANDROID_API__ 26
@courville
courville / SurfaceController.java.diff
Created December 10, 2019 17:27
SurfaceController.java.diff
diff --git a/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java b/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
index 089df18..4ebd723 100644
--- a/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
+++ b/src/main/java/com/archos/mediacenter/video/player/SurfaceController.java
@@ -20,6 +20,7 @@ import com.archos.medialib.IMediaPlayer;
import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView;
+import android.os.Build;
import android.util.Log;
@courville
courville / smbcli.java
Last active February 17, 2023 09:13
Simple jcifs-ng cli test program
import jcifs.smb.SmbFile;
import jcifs.context.BaseContext;
import jcifs.smb.NtlmPasswordAuthenticator;
import jcifs.CIFSContext;
import jcifs.CIFSException;
import jcifs.smb.SmbException;
import jcifs.smb.SmbAuthException;
import java.net.MalformedURLException;
@courville
courville / sadb.sh
Created January 4, 2019 14:12
adb connect on a chromebook crostini container to android
adb connect 100.115.92.2:5555
@courville
courville / adbdate.sh
Created January 4, 2019 14:10
force date and time via adb based on host result
adb shell su root date -u @$(date -u +%s)
@courville
courville / fixsambamangled.sh
Created January 4, 2019 14:07
fix filenames to avoid samba client name mangling
find . -type f -name \*"[\*\?\:<>\\\"\|]"\* -print0 | xargs -0 rename -v 's/[\*\?\:<>\\\"\|]/_/g'