bennettpeter / android-MythTV-Leanfront

:tv: MythTV Android TV frontend
GNU General Public License v3.0
45 stars 9 forks source link

MythTV Leanback Frontend (leanfront): Android TV frontend for MythTV

Leanfront is a frontend for MythTV that runs on Android TV and Amazon Fire TV devices. Leanfront supports playback of recordings and videos from MythTV. It can also schedule recordings using voice search or a program guide, and search for recordings or videos using voice.

Leanfront can be installed from the Google play store or the Amazon store, depending on your device.

Table of Contents - [Main Screen](#main-screen) - [Recording Group Screen](#recording-group-screen) - [Detail Screen](#detail-screen) - [Related Videos](#related-videos) - [Videos Screen](#videos-screen) - [Playback Screen](#playback-screen) - [Search](#search) - [Tools](#tools) - [Settings](#settings) - [Backup / Restore](#backup--restore) - [Backend Status](#backend-status) - [Manage Recordings](#manage-recordings) - [Program Guide](#program-guide) - [Recording Rules](#recording-rules) - [Upcoming Recordings](#upcoming-recordings) - [Schedule Recording](#schedule-recording) - [Installing leanfront](#installing-leanfront) - [History](#history) - [Leanfront Features](#leanfront-features) - [Release Notes](#release-notes) - [Playback](#playback) - [Frame Rate Synchronization](#frame-rate-synchronization) - [Bookmarks and Last Play Position](#bookmarks-and-last-play-position) - [Commercial Break and Cut List](#commercial-break-and-cut-list) - [Live TV](#live-tv) - [Playback controls](#playback-controls) - [Top Row of Controls](#top-row-of-controls) - [Progress Bar](#progress-bar) - [Bottom Row of controls](#bottom-row-of-controls) - [Playback Menu](#playback-menu) - [Remote Control](#remote-control) - [General Operation](#general-operation) - [Status Port](#status-port) - [Screen saver and idle shutdown](#screen-saver-and-idle-shutdown) - [Videos and Recordings](#videos-and-recordings) - [Parental Level](#parental-level) - [Refresh Lists](#refresh-lists) - [Copy from one Android device to another](#copy-from-one-android-device-to-another) - [Important Notes](#important-notes) - [Problems](#problems) - [Error handling](#error-handling) - [Debugging](#debugging) - [Android Phones / Tablets with touch screen](#android-phones--tablets-with-touch-screen) - [Program List](#program-list) - [Details page](#details-page) - [Playback](#playback) - [Leanfront Restrictions / Limitations](#leanfront-restrictions--limitations) - [Install on Laptop or Desktop](#install-on-laptop-or-desktop) - [Building](#building) - [Internationalization](#internationalization) - [License](#license)

Main Screen

Recently Viewed List The top line of the main screen shows "Recently Viewed" items if that option is selected in Settings. This helps you keep track of what you are watching. Recommended Settings: - Enable recently viewed list in settings. - Enable deleted and watched items in the recent list. - Enable "Trim recently viewed list" to only see the latest episode of each series you are watching. - Disable deleted and watched items in the "related" list. - In mythfrontend, set the deletion delay for deleted shows to 7 days or longer. Now, for example, if you watched and deleted an episode yesterday, the deleted episode shows at the front of the recent list. Select that episode from the recent list. Go down in the details screen to the related list. You will see unwatched, undeleted episodes of the series and you can select one to play.
More details - A list of recording groups is displayed on the left with titles in the group in a scrolling row on the right. Next to each icon on the left is a number that represents the number of entries on the right in that row. This is not necessarily the same as the number of recordings because on the main screen there is one entry per series. Select a group and press enter to open the screen with that group's contents. Once a group is open there is one entry per episode. - You can customize what is shown and the order in which it is shown, using the [Settings](#settings) icon in the [Tools](#tools) row at the bottom of the page. - The LiveTV group shows recordings already made from Live TV as well as channels available to watch live. - On the top-level screen only, there is a list of recently viewed items. This can be customized in settings to select how far back it goes or to disable it entirely. - There is a row for "All" at the top. - If you have Videos in the Video storage group on the MythTV backend, there is a row at the bottom showing videos organized by directory. Selecting that row and pressing enter opens the [Videos Screen](#videos-screen) - There is a row labeled "Tools" at the bottom. There are various options available there. - Indicators next to recordings show πŸ—‘ for deleted, πŸ‘ for Watched, πŸ’₯ for damaged.

Recording Group Screen

Working with a series Select the header for a series and do a "long press" or press the menu button if your remote has one. You will get a menu that lets you mark the entire series as watched or unwatched, delete or undelete it, remove bookmarks, allow rerecord or remove from recently watched list.
Paging Scroll through the list using up/down arrows and left/right arrows. This can be slow when there is a long list of shows or episodes. You can now use the Fast Forward and Rewind buttons of the remote to get though these lists more quickly. When the header (left hand) pane is visible, Fast Forward will scroll down a page at a time. When the header pane is not visible, Fast Forward will scroll across one row a page at a time. If you don't have Fast Forward and Rewind buttons, Page Down / Page Up, or Play Next / Play Previous can be used. You can connect a bluetooth keyboard and use these combinations. You can also buy a Bluetooth remote that has multimedia buttons including Fast Forward and Rewind.

Detail Screen

Related Videos

See this by pressing Down on the Detail Screen. A horizontal list of other episodes of the series is shown, If you have selected a recording from the main page and you actually want to see a different episode of the series, you can find it here.

Videos Screen

Videos from the Videos part of MythTV are shown here, organized by directory. You can drill down to subdirectories or play videos from this screen.

Operating on a directory Select the header for a video directory and do a "long press" or press the menu button if your remote has one. You will get a menu that lets you mark the entire directory as watched or unwatched,remove bookmarks or remove from recently watched list. This operation is not recursive. If there are subdirectories in a video directory, any operation on the directory will be performed on videos in that directory only.

For information on paging through videos see the Paging section of Recording Group Screen.

Playback Screen

Search

Select the magnifying glass at the top left hand side of most screens, and press enter. You will see the following:

Tools

At the bottom of each list screen is a row named "Tools", that provides application-wide tools.

Settings

Backup / Restore

A button at the top of the page allows backup and restore of settings and the local SQLite database. These are backed up into the documents directory of your Android TV device. If you install a file explorer such as File Manager Plus or Cx File Explorer, you can use ftp to download the files on to a computer.

Thi feature always backs up the settings to leanfront_settings.xml and the database to leanfront.db. If you do a second backup it overwrites the prior one. To save a prior backup, rename the backup file before taking a new backup.

If you use "Recently Viewed" to keep track of what you are watching, bear in mind it keeps the list locally on Android, so each Android TV device has its own list. The database backup can be restored to a different Android TV device to transfer your recently viewed list.

The settings can be restored to a different Android TV device to avoid having to set them up on the new device. These backups can also be used to restore settings and database if you uninstall leanfront and then install it again.

Notes ### Playback groups If you have playback groups defined in mythfrontend, the Playback section is repeated for each playback group. The settings can be varied for each playback group. When adding a playback group in mythfrontend, the new playback group will have default settings in leanfront. If you have a setting that you want to change for all playback groups, you have to set it here in each playback group. ### Advanced The advanced section of settings includes a value that may need to be changed to suit unusual circumstances. Be careful when changing it as you may cause bad things to happen if you use inappropriate values. - **TS Search Packets.** Increase this if when playing a recording or other TS file, the recording length does not show in the OSD, and you cannot use skips or bookmarks. The default value supplied with exoplayer is 600. I have set a default value of 2600 in leanfront. The value is limited to a range of 600 - 100,000. Increasing the value will cause the start of playback to take longer and use more memory. Also skips forwards and back will take longer. Thus it is best to make this the smallest value that works for you. - **Maximum Recordings/Videos to load.** Leanfront can handle an unlimited number of recordings and videos. However loading huge numbers of recordings and videos results in excessively long times to load the listing. WIth 60,000 recordings it takes about 3 minutes to load he list from the backend and another 3 to 4 minutes to format the display. To avoid this, the system defaults to loading the only the most recent 10,000. If you are happy with waiting minutes for the screen to refresh, you can increase the value. If you want a quicker refresh you can reduce the value. - **Number of Minutes Between Backend Refreshes.** The system refreshes the list periodically from the backend to pick up new recordings or changes. This setting must be a multiple of 4. If you need to see recordings in the list as soon as possible, set a low number. If you have a huge number of recordings it may take long to refresh so this setting may not help. In that case adjust the **Maximum Recordings/Videos to load** setting.

Backend Status

Backend status can be scrolled down using arrow keys.

Manage Recordings

There are three rows available.

Upcoming Recordings

Edit a recording rule by selecting the name or the pencil icon on an upcoming recording and pressing Enter. Create an override rule for one showing or one episode by selecting the paperclip icon. The "Show All Status Values" checkbox allows you to see showings that are not to be recorded. This allows you to select one of the excluded showings so that it can be overridden or scheduled.

Recording Rules

Program Guide

Paging Scroll through the list using up/down arrows and left/right arrows. This can be slow when there is a long list of channels. You can now use the Fast Forward and Rewind buttons of the remote to get though the list more quickly. Fast Forward will scroll down 45 channels at a time (5 pages). If you don't have Fast Forward and Rewind buttons, Page Down / Page Up, or Play Next / Play Previous can be used. You can connect a bluetooth keyboard and use these combinations. You can also buy a Bluetooth remote that has multimedia buttons including Fast Forward and Rewind.

Schedule Recording

The page that updates recording rules is similar to the corresponding page in mythfrontend.

New Episodes Only The feature "New Episodes Only" is disabled unless you have a recent build of mythbackend. There is a bug in older versions of mythbackend that prevents this from working.
TV or Movie Metadata ![](ScreenShots/Metadata.png) When adding or updating recording rules, the metadata section includes a search to find the correct movie or series id. There are three options for TV shows, TheTVDB, TVmaze and TMDB. For movies there are two options, TheTVDB and TMDB. If the show that has been selected has a different name from what is shown in the schedule, you can search on this different name, by changing the search phrase. For example, PBS shows are often called "xxxx on Masterpiece", for example "Poldark on Masterpiece". In this case, searching for "Poldark on Masterpiece" finds nothing, but by changing the search phrase to "Poldark", you can find the series details. You can use TheTVDB, TVmaze or TMDB, as long as you have a recent backend that supports the option. If your show is not found on one service, you can try the others. This does not depend on the default lookup method selected in mythfrontend. In mythfrontend you can select TheTVDB, TVmaze or TMDB as the default. Even if you have selected one as the default, you can still use another for specific record rules.

Installing leanfront

You need an Android TV device, which can be a Nvidia Shield, Amazon Fire TV stick, Amazon Fire TV, or other name brand or generic Android TV device.

Amazon Fire TV

If you have an Amazon Fire TV, Fire Stick or Fire Cube, you can install from Amazon App store. For a new installation, just press the microphone button on your remote and say "MythTV". Alternatively, log on to amazon.com, search for MythTV or leanfronte, and request it to be installed to your device.

If you already have leanfront installed by downloading from orangedox, to install from the app store you will have to first uninstall it.

Non Amazon devices

Leanfront is available in the Google Play Store, for TV devices. Either go to play.google.com or use the play store from the android device and search for MythTV or leanfront. If you have previously installed an apk from orangedox.com, you do not need to uninstall, the play store will upgrade it.

Side Load

Preferably use the play store or app store for installation.

Packages are also available here, in case you want to install on a phone or tablet, or cannot install from the play store: https://drive.google.com/drive/folders/1LMf7dTK_fD_e1S3S2HgB1NEPsWI0MdyB

To install a side load version you can download the apk file from the above link. Put it on your android device using direct download, a USB cable or another method. Open a file manager, select the apk file and tap on it to install. Alternatively you can use adb to install from a computer if you have developer mode enabled on the android device.

After Installation

The first time you run the app it will prompt you for the MythTV Backend settings. Supply the IP address or DNS name of the master backend. If you have MythTV V32 or V33, change the status port from 6544 to 6744. (Note that 6544 still works but does not support the latest features). In V34, port 6544 now has full support. In future port 6744 may be removed.

History

Leanfront is based on the sample Videos By Google app, designed to run on an Android TV device. It uses the Leanback Support library which, according to the author, "enables you to easily develop beautiful Android TV apps with a user-friendly UI that complies with the UX guidelines of Android TV".

Leanfront Features

Release Notes

You can see a list of changes in each version by looking at the commit list in github. See https://github.com/bennettpeter/android-MythTV-Leanfront/commits/master .

Playback

Frame Rate Synchronization

If you are playing a video or recording that was recorded at a different frame rate from the default for your android device, motion may appear jerky. Frame Rate Synchronization fixes this by changing the refresh rate of your TV to match the frame rate of the video. Select "Match original frame rate" in the playback settings. With Amazon Fire TV Stick you also need to enable the "Match original frame rate" setting in the Fire TV settings.

Bookmarks and Last Play Position

Bookmarks in a recording or video can be stored in the android device or in the MythTV backend. In Settings, Playback you can select an option to store them locally. On versions of mythbackend before v32-Pre-658-g48557d32c2 or v31.0-73-g7bf1284867, video bookmarks are always stored locally.

Bookmarks must be set explicity using the bookmark OSD option of playback menu. They can be removed from the video details page menu.

Last Play Position is always set upon stopping playback and the default on starting playback is to start at Last Play Position. It can be cleared from the Video deatils page menu.

If local bookmarks are not selected:

Commercial Break and Cut List

If you run mythcommflag or comskip to detect commercials in a recording, or you use Edit mode in mythfrontend to add a cut list, leanfront now supports skipping over cuts or commercial breaks.

There is a Setting on the Settings page, "Commercial or Cut Skip". You can select "Off", "Notify", or "Automatically Skip". These apply to both flagged commercials and cut lists. If a cut list exists the commercial breaks are ignored.

If "Off" is selected, cut lists and commercial breaks flagged are ignored, and everything plays.

If "Notify" is selected, when a Cut or Commercial Break is encountered, a menu is displayed at the bottom left of the screen, with options "Skip" or "Do Not Skip". If you select "Skip", playback immediately skips to the end of the cut or commercial. If you select "Do Not Skip" or leave the meunu without selecting anything, it will continue playing. At any stage of playing in the cut or commercial, you can select "Skip" to go to the end.

If "Automatically Skip" is selected, playback will automatically skip each cut or commercial flagged.

The three options can also be selected or changed during playback by using the playback menu and selecting "Commercial or Cut Skip". Changes made here only affect the current playback.

You can skip forward and backward to the next or prior commercial break. This is similar to using the z and q keys in mythfrontend. Since there are very few buttons available on most android tv remotes, the Settings page allows you to reassign certain buttons to the skip commercial functions.

In the settings there are adjustments to start and end position that can be set. Setting a negative value means that it will skip that number of seconds early, setting a positive value will skip that number of seconds late. To make sure that absolutely no commercial is shown, you can make the skip larger by setting a negative value for start adjustment and a positive value for end adjustment. However you could miss a second or two of actual show. In the opposite situation, if you are unsure whether commercial skip works correctly, you can make the skip shorter by setting a positive value in the start adjustment and a negative value in the end adjustment. Then you will see a few seconds of commercial at the start and end of the break, so that you can be sure it is only skipping commercial and not skipping part of the show.

There is currently no way to edit a recording or video in leanfront. That can only be done in mythfrontend.

Leanfront also supports skip and cut lists in Videos in the "Videos" storage group. For this you need mythbackend version v33-Pre-925-gf702d54093 or later, and you need to use the new http port (6744).

Live TV

There are two way to start Live TV viewing.

When Live TV is selected, either from the Live TV group or from the program guide, a recording is set up with the name and details of the current show in the program guide. When that program ends, it continues on to the next program in the guide, setting up a recording and playing it.

During Live TV it shows a "Record" button and menu item. Clicking this converts the temporary Live TV recording to a permanent recording in the Default group, and ensures the program is recorded to the end, even if you exit Live TV watching.

You can customize the display of rows in the Live TV group. Instead of groups of 100 channels, if you are using broadcast TV where there are fewer channel numbers and there may be sub-channels, you can set the number per row to a smaller number, e.g. 1 or 10. This is in the Settings under "Program List Options", near the bottom.

Notes:

Playback controls

The following controls are available when pressing enter during playback. Select an icon and press enter to apply it. The name of the currently selected icon is displayed below the progress bar.

Top Row of Controls

Icon Usage
Play/Pause Switches between pause icon and play icon depending on the current state.
Skip Previous Skip back to the previous commercial break, or to the prior episode if at the beginning of the recording (see Related Videos).
Rewind This skips back by the time set in the settings.
Jump Forward This skips forward by the time set in the settings.
Skip Next Skip forward to the next commercial break, or to the next episode if there are no more commercials (see Related Videos).
Change Playback Speed Speeds up or slow down playback by increments to a maximum of 800%. Shows a seekbar where any desired speed can be selected in increments of 10%
Playback Menu Shows a menu of playback actions that can be taken.

Note: When using Change Playback Speed the program will disable digital audio pass-through if it is in use, by temporarily selecting FFmpeg audio decode. This will disable surround sound until you exit playback.

Progress Bar

This shows playback position plus time played and total time. While this is focused you can use left and right arrows to skip back and forward. Holding the arrow down moves quickly through the recording. While this is focused, pressing Enter pauses and resumes. Below the progress bar is displayed the description of the currently selected icon, if one is selected.

Bottom Row of controls

Icon Usage
Closed Captions Shows a menu of available subtitle tracks plus subtitle disabled. You can select one to change or disable subtitles
Picture Size Changes the picture size. Pressing this shows a seekbar. Left and right arrow fine tune the size. Up and down arrow select from several standard zoom amounts.
Stretch Horizontally Stretch or squeeze the picture in case it is showing at the wrong aspect ratio. Pressing this shows a seekbar. Left and right arrow fine tune the stretch. Up and down arrow select from several standard stretch amounts.
Move Picture If the picture has been resized, moves the picture up or down, left or right. Use up, down, left, right arrows to move it. For use when you want to cut off part of the picture, after zooming to a bigger size.
Change Audio Track Shows a menu of available audio tracks plus audio disabled. You can select one to change or disable audio track.
Adjust Audio Sync Shows a seekbar where you can change audio sync. Use this if lip sync is wrong. The value selected applies only to this playback, it is not saved after playback is ended.
Autoplay Toggle automatic playback of all videos in the Related Videos list. When activated this displays in green color. At the end of each video or recording it will automatically start the next one. It will play watched or deleted items if you selected them in settings to be included in the Related Videos list.

To see Related Videos while watching press down arrow. This shows other videos / recordings in the current group. You can select one of these to play instead of the current playing video.

Playback Menu

During playback, you can see a menu of actions by pressing the Menu button on the remote or long-pressing the center button (hold down until the menu appears). Note that long-press does not work while the OSD is on screen. The menu contains most of the items in the OSD above.

Remote Control

The Fire Stick and NVidia Shield have rather limited remote controls, however there are ways of connecting more advanced remotes, and a TV remote can be used to control the Android TV device using CEC. MythTV leanfront supports many media control keys that could be available.

Key Context Usage
Back Playback If OSD is showing, close OSD. Otherwise Stop Playback and save bookmark
Captions Playback Show menu of available captions (same as CC icon)
DPad Left Playback Selectable in Settings: Skip back number of seconds set up or skip commercial
DPad Right Playback Selectable in Settings: Skip forward number of seconds set up or skip commercial
DPad Up Playback Selectable in Settings: Dismiss OSD and navigate in OSD, jump back or skip commercial
DPad Down Playback Selectable in Settings: Show OSD and navigate in OSD, jump back or skip commercial
DPad Center Playback Show OSD
Media Audio Track Playback Show menu of available audio tracks (same as Ear icon)
Media Pause Playback Pause playback
Media Play Playback Resume playback if paused
Media Play Pause Playback Toggle playback between playing and paused
Media Rewind Playback Selectable in Settings: Skip back number of seconds set up or skip commercial
Media Fast Forward Playback Selectable in Settings: Skip forward number of seconds set up or skip commercial
Media Step Forward Playback Skip to next commercial break
Media Step Backward Playback Skip to prior commercial break
Media Skip Backward Playback Jump back number of minutes specified in settings (default is 5)
Media Skip Forward Playback Jump forward number of minutes specified in settings (default is 5)
Media Stop Playback Stop Playback and save bookmark
Media Next Playback Skip to beginning of the next Video (same as Next Track Icon)
Media Previous Playback Skip to beginning of the previous Video (same as Previous Track Icon)
TV Zoom Mode Playback Squeeze or Stretch the picture (same as Stretch Horizontally Icon)
Zoom In Playback Reduce the picture size (same as Picture Size Icon).
Zoom Out Playback Increase the picture size (same as Picture Size Icon)
Media Play List Play selected video from bookmark or beginning without first displaying details page
Media Play Pause List Play selected video from bookmark or beginning without first displaying details page
Media Play Details Page Play video from bookmark or beginning
Media Play Pause Details Page Play video from bookmark or beginning

If "Use Up/Down Arrows for Jump" is selected in settings, the following apply. However, this may make navigating the OSD more difficult.

Key Context Usage
DPad Up Playback Jump forward number of minutes specified in settings (default is 5)
DPad Down Playback Jump back number of minutes specified in settings (default is 5)

General Operation

Status Port

In mythbackend V32 and later, the web server has been rewritten and there is a new status port. The old status port still works but does not support the latest features, like "Last Play Position". To use the latest features, change your port number in settings to 6744. If you have any problems with this please open a ticket.

This is a temporary change, in V34 the port changes back to 6544, with the new features. Port 6744 is still supported in V34 and is an alternative port for the same code as port 6544. At some point, 6744 may be disabled. You will then have to change your settings back to port 6544.

Screen saver and idle shutdown

If you have a mythbackend earlier than v30 you need to disable the mythbackend idle shutdown, as leanfront cannot prevent shutdown, even while playing. On v30 and later, leanfront prevents backend shutdown while leanfront is in the foreground on the TV.

If you have screen saver enabled on the android tv stick, if nothing is playing it can start the screen saver. When it starts leanfront will go into the background. While leanfront is in the background mythbackend can shut down. When you press a remote key, the tv shows leanfront again but the backend may be shut down. Leanfront does not recover gracefully from this. Attempts to play will display a generic error message.

If you have auto shutdown enabled on the backend, then I recommend you disable the tv stick screen saver or else set it to a long period and be aware that when waking again, the backend must be restarted if it has shut down.

Videos and Recordings

Videos are items from the MythTV Video storage group. They are shown at the bottom of the main summary page. You can click on them to open subdirectories, through multiple levels.

There is a setting, Program List Options, Merge Videos with Recordings. That is for when you have a series that is partly in recordings and partly in Videos. In the row of the screen for the recording group, any videos that match a series will also be shown. This way, if you have some episodes that were recorded outside of MythTV, you can add them to Videos and see them with the recordings you made on MythTV. You need to have the correct series title, season and episode with the video metadata. In most cases the metadata lookup will fill that in for you. You also need to select sort option of "original air date" to get the episodes in correct order.

Parental Level

There is support for the MythTV parental level on videos. It does not support the PIN, so hope your children do not know how to get into settings. There is a setting at the bottom of program list options to specify the level - 1 2 3 or 4. Only those videos below or equal to the level set will be visible. You will have to use mythfrontend to set the level on the videos, there is nothing to do that in leanfront.

Refresh Lists

There is a "Refresh Lists" icon on the tools row to refresh the list of recordings and videos from the backend. The list is also refreshed after using Settings if you change the backend ip address or port number. Refresh only refreshes what is on the current view. On the main screen (the one with the MythTV Icon at the top), it refreshes everything. The refresh does not perform a video rescan at the backend, currently you will have to do it from a normal frontend or run "mythutil --scanvideos" on the backend. Refresh is also performed automatically in teh background every hour or other interval as specified in Settings, Advanced.

If refresh takes a long time, it is likely caused by lookups on the recordedartwork table. This can be caused by the lack of a database index. This has been fixed in v32-Pre-642-ga0017739a0. If you are running an earlier version you can run the following command to create the index. You can do this on any version of MythTV. If you later upgrade to v32 it will detect if the index has already been created and will not create it again.

To create the index, run the following from a command line:

mysql -u <UserName> -p <DatabaseName>
CREATE INDEX recordedartwork_ix1 ON recordedartwork (inetref);
quit

UserName and DatabaseName can be found in the file .mythtv/config.xml. You will be prompted for the database password, which can also be found in .mythtv/config.xml.

Creating this index changed the refresh time on my system from 38 seconds to 4 seconds, so it can make a big difference.

Copy from one Android device to another

If you use "Recently Viewed" to keep track of what you are watching, bear in mind it keeps the list locally on Android, so each Android TV device has its own list.

See Backup / Restore for the best way to copy these files. The script described below only works on debug builds, so it will not help with leanfront installed from the app store or play store. The Backup / Restore feature works on both debug and production builds.

There is a script to copy files to and from an android device debug application.

This only works on debuggable builds. The release builds of leanfront not debuggable, so it will not work on those.

There is a script acopy.sh in the extras directory of the git repository. This has be be copied to a Linux system. It needs adb installed on the Linux system. acopy.sh can be used to copy settings and databases from one android device (e.g. fire stick) to another. Since the "Recently watched" list is stored locally it is different on each android device. Also local bookmarks are different per device. You can copy these from one device to another. The prior values on the receiving device are lost. There is no merging of databases.

Run acopy.sh to see a list of options.

acopy.sh can be used for any application to copy any files, but it requires that the application be debuggable.

Important Notes

Problems

In earlier versions of leanfront, some recordings or videos may not play correctly, or may not play at all. In some cases, videos may play but the duration may not show in the OSD and skipping forward may not work. These problems have been fixed as far as I know. If this still happens, try increasing the TS Search Packets in the Advanced section of Settings. See documentation of Settings above. Please let me know if you still experience this.

In videos that have been cut or processed using mythtranscode, audio may be garbled. If the recording plays correctly with mythfrontend or VLC but not with leanfront, try running one of these commands (below) against the file. Use the first one for recorded programs only (mpeg ts streams). The second command can be used for recordings or videos. The second command converts the file to mkv format. You do not need to use an mkv extension, a ts or mpg extension will also work for an mkv format file.

ffmpeg -i inputfile -acodec copy -vcodec copy -scodec copy -f mpegts outputfile
mkvmerge -o outputfile inputfile

You can overwrite the recording or video file with the output from one of these commands. Both of these commands run very quickly and recreate the file with any inconsistencies fixed. The mkvmerge command seems to be better than ffmpeg at fixing most problems.

You can create a user job to run one of these commands after each recording if necessary.

Error handling

Playback errors sometimes occur, often when skipping forward, but also at other times. The program will try to recover from the error. If you select in settings "Playback -> Show Playback Error Toast" it will display a brief message that there was an error. If errors continue, it will show a dialog box where you can choose to continue or exit. The "continue" option will attempt to bypass the error. This may not always succeed. Playback errors are logged, and you can see the log messages using the procedure in "Debugging" below.

Debugging

There are a few log messages generated by the program. To see the program specific log messages run these commands:

adb connect <ip address>
adb logcat lfe:D *:S

If the program crashes, the above command may not show anything useful. To get the full system log, including crash reports, run these commands:

adb connect <ip address>
adb logcat

Android Phones / Tablets with touch screen

You can install leanfront on a phone or tablet if you are running Android 5.0 (Lollipop) or later version. The application is designed for Android TV and using it with a touch screen is not the same as other touch screen applications.

There are some problems. Program lists do not work as expected, see below. Leanfront uses landscape mode, and if you rotate it, the display will remain landscape. See below for more differences when operating a touch screen.

Program List

Details page

On a phone the Play and other action buttons may be too big and may not all display. To see buttons that are off screen, drag with your finger.

Playback

Install on Laptop or Desktop

The quality of video and audio playback is not good on the emulator. However, if you want to use the scheduling options that are available on leanfront, such as scheduling and metadata lookup, that can easily be done on a PC from the emulator.

The release package is built for arm 32 bit and 64 bit devices. The debug version is built for those plus x86 and amd64 devices. You can install Android Studio, then install an android emulator and run the debug package on the emulator. Note that the emulator plays h264 (AVC) and h265 (HEVC) video. It does not play MPEG2.

After installing Android Studio, use SDK Manager to install the emulator and sdk tools. You do not need to install an SDK if you are not doing development. Then run the AVD manager to create an android TV device with recent version. Do not specify quick startup (the default) in AVD setup of the emulator. Select "Cold Boot" in advanced settings for the emulator. From AVD manager you can start the virtual device, then use adb to install the apk file as you would with a real android device. Note that with the emulator you do not need to connect adb to the device, it is automatically connected when you start the emulator. Don't forget to set time zone in the emulator settings. After setting it up, you can subsequently start up the emulator from a command line or script that runs this:

    $HOME/Android/Sdk/emulator/emulator -avd <virtual device name>

Building

Internationalization

The source code supports multiple languages. There is a python script that translates strings into several languages using Google Translate. The results are likely not optimal, but may be better than nothing. The system does allow for manual fixing of translation errors. If anybody wants to volunteer to correct translations for a language please email me or create an issue in https://github.com/bennettpeter/android-MythTV-Leanfront/issues . The list of strings is at https://github.com/bennettpeter/android-MythTV-Leanfront/blob/master/app/src/main/res/values/strings.xml . The translations are in various directories under https://github.com/bennettpeter/android-MythTV-Leanfront/tree/master/app/src/main/res , named vales-xx where xx is the language code.

License

Licensed under the GNU GPL version 3 or later. See the LICENSE file for details.