Friday, 29 June 2018

Installing Plex media server on a Raspberry Pi

This post was covers installing Plex media server on a Raspberry Pi 3 B+ running Raspbian Stretch Lite.

In this case I had already attached an external drive and set up Samba so I could easily add media files to the drive from my Windows PC. See this post for details.

Step 1

Firstly I added a new repository to apt so I could install it using apt-get. To do this I needed to get access to the dev2day.de repository.

SNAGHTML13bbc6e

First step was to download the key and add it to apt. I switched to be su for this. The commands below show what was run but not any of the resulting output.

sudo su
wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add -
exit

Step 2

Then I created a new sources file for Plex.

cd /etc/apt/sources.list.d
sudo nano plexmediaserver.list

I then added the following line to the file and saved it.

deb https://downloads.plex.tv/repo/deb/ public main

Note the version of Raspbian is Stretch. Modify the command for different versions.

image

Then I updated apt-get so it has the latest package lists.

sudo apt-get update


Step 3

Now I could install Plex.

sudo apt-get install plexmediaserver-installer

Step 4

I wanted to move the Plex database from the SD card storage in the Raspberry Pi to the external drive.

To do that stopped Plex before I moved the Plex library folder from its original location to a new location on the external drive. I then created a symbolic link to in place of the original folder that pointed to the new location. Once that had been done I could restart Plex. Plex would still look for its library in the original location but be redirected by the symbolic link.

sudo service plexmediaserver stop
sudo mv /var/lib/plexmediaserver /media/seagateHDD/plexmediaserver/
sudo service plexmediaserver start


image

Step 5

Then it was just a case of accessing Plex from a browser on my PC to check it was working. It was! I then started creating new libraries in Plex. The seagateHDD showed up nicely, along with the Media folder containing my video files.

The Plex server was available at http://192.168.0.20:32400/web/.

SNAGHTML15362b0

Job done.

Attaching an external hard drive to a Raspberry Pi

This post was covers installing an external USB hard drive to a Raspberry Pi 3 B+ running Raspbian Stretch Lite.

Firstly, I had terrible trouble getting my Seagate Expansion 2 TB USB 3.0 Desktop 3.5 Inch External Hard Drive to work correctly. Endless permission issues, problems with Samba, you name it.

The key to solving these issues was to install the NTFS-3G driver rather than using the standard NTFS driver when mounting the drive. I’ll cover that as I go in the steps described below.

Step 1

I started with the Raspberry Pi shutdown and simply attached the drive to a vacant USB port on the Pi. I the powered up the drive and then the Pi.

Step 2

SSH to the Raspberry Pi as usual. I then ran the following command to see what drives were now attached.

sudo blkid


image

I looked for the new Seagate drive which in this case was /dev/sda2. I made a note of the information, especially the UUID which I used later.

Step 3

So, I’m skipping all the trial and error here but the next significant thing to do is install the NTFS-3G driver using apt-get.

sudo apt-get install ntfs-3g


image

Step 4

Time to mount the drive on the file system. I chose to mount the drive under /media rather than /mnt or any other location. So, I created a folder specifically for the drive (/media/seagateHDD) then mounted the drive to that folder.

cd /media
mkdir seagateHDD
sudo mount /dev/sda2 /media/seagateHDD/ -t ntfs-3g

 NB: Note the use of the –t ntfs-3g option.

image

This proved the drive could be mounted and that it worked. As you can see permissions are wide open.

Step 5

Now we need to set up the system to reconnect the drive at start-up. For this I modified the fstab file.

sudo nano /etc/fstab


SNAGHTMLdb69cc 

And added the following line. Note the use of the UUID rather than /dev/sda2. This helps to ensure the same drive gets reattached just in case the device changes.

UUID=FC82A10F82A0D006 /media/seagateHDD ntfs-3g defaults 0 0


image

Step 6

Time to install Samba. Firstly I installed Samba using apt-get.

sudo apt-get install samba samba-common-bin


image

When that was done I edited the samba configuration file.

sudo nano /etc/samba/smb.conf

And added the following section.

[media]
     writeable = yes
     public = yes
     directory mode = 0777
     path = /media/seagateHDD/Media
     comment = Pi shared media folder
     create mode = 0777

Note that there was an existing folder called Media on the drive. I chose to make that folder accessible via Samba.

image

The a quick restart of Samba to read the new configuration.

sudo /etc/init.d/samba restart

Step 7

Test from Windows. I just added a Media Location mapped to my Raspberry Pi’s IP address and the media share and that was it!

Tuesday, 26 June 2018

Quick headless setup of a Raspberry Pi 3

Here are the steps taken to get a Raspberry Pi 3 B+ up-and-running on my home network but doing so headless – no monitor etc. attached.

Step 1

Follow the basic installation guide from raspberrypi.org to flash a micro SD card. I used the Rasbian Stretch Lite image and Etcher to flash the image onto the SD card.

image

Step 2

Create a file called ssh (no file extension) in the root of the newly created boot SD card.  This enables SSH when the Raspberry Pi starts up.

The file doesn’t need any contents. Just the presence of the file enables SSH connections to the Pi.

Step 3

Put the SD card in the Raspberry Pi, connect it to the network via ethernet and power it up.

Step 4

Access to your router management console and find the Raspberry Pi as a connected device. Note down the IP address.

If you can, use DHCP management tools to reserve the IP address so it won’t change (this makes it easier to reconnect to the Pi if you have to bounce your router).

Step 5

Use Putty or similar tool to SSH on to the Pi using the IP address from Step 4. Login as the ‘pi’ user (default password is ‘raspberry’ with no quotes).

image

Step 6

Run the following command:

sudo raspi-config

This fires up the Rasperry Pi configuration tool. Make any changes you want to (e.g. enabling wi-fi or changing the host name). Change the default password if nothing else.

image

Step 7

Run the following command:

sudo apt-get update

And then this one:

sudo apt-get upgrade

You’re done. Raspberry Pi is up-and-running.

Thursday, 1 March 2018

Suspicious Windows 10 Printer Update?

I’ve been seeing this in my Windows 10 update after receiving a notification that it failed to install:

Canon - Printer - 4/21/2000 12:00:00 AM - 10.0.17046.1000
Status: Awaiting install


SNAGHTML49d7fd

It seems I’m not alone in spotting this rather odd and somewhat suspicious issue:

See:


For now I am trying the “Show or hide updates” troubleshooter package from Microsoft which you can find here:

Monday, 27 November 2017

Elements of the Archimate 3.0 Application Layer

This post is a basic aide-memoire for me to remember the characteristics of the Archimate Application Layer model elements. For a detailed description refer to the main Archimate 3.0 documentation.

The model elements are divided into 3 categories:

  • Active Structure
  • Passive Structure
  • Behaviour


Active Structure

Element

Description

Notes

Notation

Component

Encapsulation of application functionality aligned to implementation structure

Modular and replaceable

Encapsulates behaviour and data

Exposes services and makes them available through interfaces

A self-contained unit

Independently deployable, re-usable, and replaceable

Performs one or more application functions

Functionality is only accessible through application interfaces

image

Collaboration

An aggregate of two or more application components that work together to perform collective application behaviour

Specifies which components cooperate to perform some task

A logical or temporary collaboration of application components

Does not exist as a separate entity

image

Interface

A point of access where application services are made available

How the functionality of a component can be accessed

Exposes application services

The same interface may expose multiple services

image


Behaviour

Element

Description

Notes

Notation

Function

Automated behaviour performed by a component

Describes internal behaviour of a component

Functions are exposed externally through one or more services

May access data objects

image

Interaction

A unit of collective application behaviour performed by two or more application components

Collective behaviour performed by components that participate in a collaboration

image

Process

A sequence of application behaviours that achieves a specific outcome

The internal behaviour performed by a component to realize a set of services

May realize application services

May access data objects

A component may perform the process

image

Event

Denotes a state change

Does not have a duration

May be internal or external

May have a time attribute

image

Service

An explicitly defined exposed application behaviour

Functionality is exposed through interfaces

Realised by one or more functions

Provides a useful unit of behaviour

image


Passive Structure

Element

Description

Notes

Notation

Data

Data structured for automated processing

A self-contained piece of information

Clear business meaning

image

Sunday, 12 November 2017

Speed up real-time rendering in DaVinci Resolve with Optimised Media

This post refers to DaVinci Resolve 12.5.

Real-time rendering in DaVinci Resolve can be slow. One of the first things to try is optimising your media. As I understand it, Resolve will use optimised media – which is more efficient - as a proxy for the original format media in the timeline.

To optimise a media item you can right-click on it in the media gallery and select Generate Optimised Media.

SNAGHTML613cfb16

The output will end up in the same place as other cached items (see my previous post for details).

Not surprisingly, generating optimised media can take quite a while and it appears that using this method you can only do one clip at a time.

SNAGHTML614025e1

Sunday, 12 November 2017

Speed up real-time rendering in DaVinci Resolve

This post refers to DaVinci Resolve 12.5.

Problem

OK, I don’t have a system that’s setup for video editing. As a result, playback in DaVinci Resolve is slow once I’ve added more than a few clips to the timeline, especially if I’m layering clips.

How can we speed up DaVinci Resolve so we get smooth real-time playback in the editor?

Solution

A solution might be to use the render cache in DaVinci Resolve. You can activate the render cache via the Playback > Render Cache menu item.

SNAGHTML60f70665

Note that the render cache has 2 modes: Smart and User. In short, using the Smart option allows Resolve to automatically cache items as it sees fit. In User mode clips are only cached when you indicate you want them cached. To do so, right-click on the clip and choose Render Cache Clip Source > On from the pop-up menu.

SNAGHTML60fe0aa9

When you first add an item to be cached a red line will appear at the top of the timeline above the clip. Once a clip is cached you’ll see the line turn blue.

SNAGHTML61013dd0

Tip: If you use the Smart mode and you already have a number of clips added to the timeline it might take a while to add to the cache. Your system might be slow for a while as the cache is built.

Changing the render cache location

Firstly, add the path you want to use to the Media Storage section of DaVinci Resolve > Preferences… screen. I had to restart Resolve after adding a new location or the next step failed.

SNAGHTML61242c80

image

Secondly, open File > Project settings… and go to General Options. The cache file location is at the bottom of the screen.

image