[DOCKER] Koma - kodi headless and mariadb combined


Recommended Posts

I've combined the mariadb container and my kodi helix headless container into one and called it Koma.

 

For anyone looking to setup their first mysql based kodi setup with headless library updates, this should help. I know docker guidelines frown upon putting d/bases etc.. in containers with other apps but a few people seemed to have issues so i thought this was a good idea.

 

I've also added an environment setting to the image that means you can create users and databases from the exec command line as if it were a regular d/base running bare metal or on a VM (no messing about with heidimysql or sequel etc...)

 

I've added a script too that allows for easy creation of new users ( all privileges to all databases on all hosts ) , if you need more secure users or other options, you can use the exec command line...

 

I'll also be adding a createdatabase script too a little later on.

 

 

You can use

 

docker exec -i -t Koma mysql -u root -p

 

to get to the mysql prompt , by default this container has no root password.

 

 

 

So basically it's the same as mariadb container (and can be used for other containers that require a d/b)  with the addition of kodi headless and easier creation of users etc... Hopefully not too many people will bite my head off about breaking the rules.

 

You can find it in my repo

 

http://lime-technology.com/forum/index.php?topic=37209.0

 

 

To Use : -

 

 

Add from my repo via docker ui in unraid (obviously, lol)

 

Fill out the folder mapping and port assignments, there are no variables needed for the kodi instance.

 

Let the container run for a couple of minutes to generate the default databases and kodi folders.

 

Then from the unraid command line issue this command (you will need to press enter or type in your password for root if you have changed it, to proceed.)

 

docker exec Koma createuser kodi kodi

 

that will setup user privileges for kodi, it's in the format

createuser <user> <password>

if you want to use the same command for other apps.[br]DON'T try and use createuser command for changing passwords of existing users or root

 

 

Then you need to stop and start the container from the webui, it should then be good to go and generate empty databases for kodi.

 

 

 

 

Link to comment
  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

I'm going to bite your head off, but not for security reasons.

 

I just bothered to set these up separately (well, xbmc headless, not kodi yet) and now you go an combine them into one. WTF....

 

Good idea, and hopefully it pans out and works well for new users wanting to setup mysql for multiple setups. Not sure if i'll bother to do it from my dual setup now, but its always feasible.

Link to comment

I'm going to bite your head off, but not for security reasons.

 

I just bothered to set these up separately (well, xbmc headless, not kodi yet) and now you go an combine them into one. WTF....

 

Good idea, and hopefully it pans out and works well for new users wanting to setup mysql for multiple setups. Not sure if i'll bother to do it from my dual setup now, but its always feasible.

 

I'd call that a light nibble at best, lol.

Link to comment

I was once a fan of a cobined docker but now realise it's not a great idea.  Especially something like MariaDB that might be used by multiple containers/apps.  You become dependant on the "combined container's" author who may not have any priority in upgrading the SQL portion.

 

Most of the problems people seemed to be having weren't docker related, it was the initial setup of the apps with DBs.  They would have had the same issue if they were using plugins.

Link to comment

I was once a fan of a cobined docker but now realise it's not a great idea.  Especially something like MariaDB that might be used by multiple containers/apps.  You become dependant on the "combined container's" author who may not have any priority in upgrading the SQL portion.

 

Most of the problems people seemed to be having weren't docker related, it was the initial setup of the apps with DBs.  They would have had the same issue if they were using plugins.

 

how is being dependant on another author to upgrade a sole mariadb container any different than dependant on another updating an element of a mixed container ?

Link to comment

There may not be any desire from the author to update the sql to a new version if it has no material impact on the primary app of the container. 

 

Maybe my point wasn't clear though.  Don't get me wrong, your work for the community is great and I'm also a beneficiary, this is not meant as a slight.

 

Maybe of the "docker" issues are really issues of people trying to understand how all the apps work together, inter connect. They'd have many of the same issues on a native Ubuntu build, plugs in etc.  maybe I'm old school. But people need to understand how their apps work together, maybe while learning linux at the same time which makes it harder, trust me, but after that initial hump most new apps they install will be a lot easier.

 

Bundling all the moving pieces into one seemless container, while handy, will, IMHO, won't solve the support issue but just move it further into the future when a new container is installed.

 

Again, not a dig at you slinky, I am very grateful for the work you've done.

Link to comment

Thanks for this combined docker!

 

I've started with a fresh install, and I think I almost got it up and running, but something isn't quite right.

 

Kodi takes a good while to start, and when it does it's just really slow overall.

 

This is my kodi logfile:

 

21:55:51 T:2056  NOTICE: Running database version Addons16
21:55:51 T:2056  NOTICE: Running database version ViewModes6
21:55:51 T:2056  NOTICE: Running database version Textures13
21:56:01 T:2056  NOTICE: Running database version MyMusic48
21:56:11 T:2056  NOTICE: Running database version MyVideos90
21:56:11 T:2056  NOTICE: Running database version TV26
21:56:11 T:2056  NOTICE: Running database version Epg8
21:56:11 T:2056 WARNING: JSONRPC: Could not parse type "PVR.Details.Channel"
21:56:11 T:2056 WARNING: JSONRPC: Could not parse type "PVR.Details.ChannelGroup.Extended"
21:56:11 T:2056 WARNING: JSONRPC: Could not parse type "GUI.Property.Value"
21:56:11 T:2056 WARNING: JSONRPC: Could not parse type "Setting.Details.SettingList"
21:56:11 T:2188  NOTICE: Thread LanguageInvoker start, auto delete: false
21:56:11 T:2056  NOTICE: initialize done
21:56:11 T:2188  NOTICE: -->Python Interpreter Initialized<--
21:56:11 T:2056  NOTICE: Running the application...
21:56:31 T:5668  NOTICE: Thread JobWorker start, auto delete: true
21:57:01 T:2056   ERROR: SQL: The table does not exist
                                            Query: SELECT movieview.idSet,COUNT(1) AS c FROM movieview JOIN sets ON sets.idSet = movieview.idSet GROUP BY movieview.idSet HAVING c>1
21:57:01 T:2056   ERROR: CVideoDatabase::HasSets failed
21:57:01 T:2056  NOTICE: starting zeroconf publishing
21:57:08 T:2056   ERROR: ZeroconfMDNS: Zeroconf can't be started probably because Apple's Bonjour Service isn't installed. You can get it by either installing Itunes or Apple's Bonjour Print Service for Windows (http://support.apple.com/kb/DL999)
21:57:09 T:2056  NOTICE: Webserver: Starting...
21:57:09 T:2056  NOTICE: WebServer: Started the webserver
21:57:09 T:2056  NOTICE: starting upnp server
21:57:09 T:2056  NOTICE: ES: Starting event server
21:57:09 T:5924  NOTICE: Thread TCPServer start, auto delete: false
21:57:09 T:3972  NOTICE: Thread EventServer start, auto delete: false
21:57:09 T:3972  NOTICE: ES: Starting UDP Event server on 0.0.0.0:9777
21:57:09 T:3972  NOTICE: UDP: Listening on port 9777
21:57:17 T:5668   ERROR: SQL: The table does not exist
                                            Query: select * from movieview  ORDER BY dateAdded desc, idMovie desc LIMIT 10
21:57:17 T:5668   ERROR: CVideoDatabase::GetMoviesByWhere failed
21:57:17 T:5668   ERROR: SQL: The table does not exist
                                            Query: select * from episodeview  ORDER BY dateAdded desc, idEpisode desc LIMIT 10
21:57:17 T:5668   ERROR: CVideoDatabase::GetEpisodesByWhere failed
21:57:17 T:5668   ERROR: SQL: The table does not exist
                                            Query: select * from musicvideoview  ORDER BY dateAdded desc, idMVideo desc LIMIT 10
21:57:17 T:5668   ERROR: CVideoDatabase::GetMusicVideosByWhere failed
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM tvshowview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM tvshowview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM movieview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM movieview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM movieview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM movieview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM musicvideoview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM musicvideoview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM musicvideoview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM musicvideoview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount) FROM tvshowview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount) FROM tvshowview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(totalcount) FROM tvshowview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(totalcount) FROM tvshowview LIMIT 1'
21:57:37 T:5668   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount = totalcount) FROM tvshowview LIMIT 1
21:57:37 T:5668   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount = totalcount) FROM tvshowview LIMIT 1'
22:00:05 T:4572  NOTICE: Thread BackgroundLoader start, auto delete: false
22:00:16 T:3628  NOTICE: Thread JobWorker start, auto delete: true
22:00:22 T:5696  NOTICE: Thread BackgroundLoader start, auto delete: false
22:00:28 T:3628  NOTICE: localGetNetworkResources: Can't open network enumeration for "Web Client Network" (provider "Web Client Network"). Error: 1222
22:00:28 T:3628  NOTICE: localGetNetworkResources: Can't get servers from "Web Client Network", skipping
22:01:11 T:2124  NOTICE: Thread VideoInfoScanner start, auto delete: false
22:01:11 T:4104  NOTICE: Thread JobWorker start, auto delete: true
22:01:17 T:3348  NOTICE: Thread BackgroundLoader start, auto delete: false
22:01:21 T:2124  NOTICE: VideoInfoScanner: Starting scan ..
22:01:27 T:5160  NOTICE: Thread BackgroundLoader start, auto delete: false
22:01:35 T:2124  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:23
22:01:57 T:4320  NOTICE: Thread JobWorker start, auto delete: true
22:02:27 T:2056   ERROR: SQL: The table does not exist
                                            Query: SELECT movieview.idSet,COUNT(1) AS c FROM movieview JOIN sets ON sets.idSet = movieview.idSet GROUP BY movieview.idSet HAVING c>1
22:02:27 T:2056   ERROR: CVideoDatabase::HasSets failed
22:02:41 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from movieview  ORDER BY dateAdded desc, idMovie desc LIMIT 10
22:02:41 T:4104   ERROR: CVideoDatabase::GetMoviesByWhere failed
22:02:41 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from episodeview  ORDER BY dateAdded desc, idEpisode desc LIMIT 10
22:02:41 T:4104   ERROR: CVideoDatabase::GetEpisodesByWhere failed
22:02:41 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from musicvideoview  ORDER BY dateAdded desc, idMVideo desc LIMIT 10
22:02:41 T:4104   ERROR: CVideoDatabase::GetMusicVideosByWhere failed
22:03:01 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM tvshowview LIMIT 1
22:03:01 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM tvshowview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM movieview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM movieview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM movieview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM movieview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM musicvideoview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM musicvideoview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM musicvideoview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM musicvideoview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount) FROM tvshowview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount) FROM tvshowview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(totalcount) FROM tvshowview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(totalcount) FROM tvshowview LIMIT 1'
22:03:02 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount = totalcount) FROM tvshowview LIMIT 1
22:03:02 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount = totalcount) FROM tvshowview LIMIT 1'
22:03:02 T:6136  NOTICE: Thread JobWorker start, auto delete: true
22:03:22 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from movieview  ORDER BY dateAdded desc, idMovie desc LIMIT 10
22:03:22 T:4104   ERROR: CVideoDatabase::GetMoviesByWhere failed
22:03:22 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from episodeview  ORDER BY dateAdded desc, idEpisode desc LIMIT 10
22:03:23 T:4104   ERROR: CVideoDatabase::GetEpisodesByWhere failed
22:03:23 T:4104   ERROR: SQL: The table does not exist
                                            Query: select * from musicvideoview  ORDER BY dateAdded desc, idMVideo desc LIMIT 10
22:03:23 T:4104   ERROR: CVideoDatabase::GetMusicVideosByWhere failed
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM tvshowview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM tvshowview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM movieview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM movieview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM movieview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM movieview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(1) FROM musicvideoview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(1) FROM musicvideoview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT count(playCount) FROM musicvideoview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT count(playCount) FROM musicvideoview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount) FROM tvshowview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount) FROM tvshowview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(totalcount) FROM tvshowview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(totalcount) FROM tvshowview LIMIT 1'
22:03:49 T:4104   ERROR: SQL: The table does not exist
                                            Query: SELECT sum(watchedcount = totalcount) FROM tvshowview LIMIT 1
22:03:49 T:4104   ERROR: CDatabase::GetSingleValue - failed on query 'SELECT sum(watchedcount = totalcount) FROM tvshowview 

Link to comment

from a brief foray into google land, it appears to be one of two possibilities as to what is wrong.

 

the first is that you are using host names for media sources rather than ip addresses

 

ie //unraid/movies etc .... instead of 192.168.1.1:/movies (i left out the smb or nfs part as i don't know what you are using)

 

 

or

 

and this is quite rare occassion,(i've found at most 5 cases in forum search via google) , every now and then xbmc/kodi gets into a tizz with creating tables in mysql.

 

 

first is easy to fix, change media sources to use ip rather than host name (in whichever system you're doing the main scan from, all other kodi instances with the same settings for mysql will pick up the sources without need for sources.xml, unless you have pasworded shares)

 

 

second cause, well that's a complete back to the beginning on the container, clearing out any existing config files and delete the container and image. as you said this was fresh install, that shouldn't be too much of a problem for you regards previously scanned media.

 

 

 

 

Link to comment
  • 1 month later...

Hey Sparkly,

 

Got it all setup and functioning, except for the important part of updating the database...

 

When Sonarr downloads and sends its command to update the library and clean, it only cleans. Same goes for couchotato, library doesn't get updated.

 

I know you said "don't use Kodi's WebUI": but from there the update library button does update the library.

 

Updating from Sonarr to the clients (HTPC and tablet) works. It's just the Headless Kodi that doesn't get updated..

 

Any ideas?

 

Thx, LoLig

Link to comment

Ok fixed it  ::)

 

I thought I had everything double checked.. Couch wasn't working cause i had it set to "Only scan new movie folder at remote XBMC servers", which doesn't work somehow. Deselecting that option made it work. And Sonarr didn't work because of some weird reason, fixed it with this: https://forums.sonarr.tv/t/solved-kodi-not-importing-newly-downloaded-episodes/4317/7

 

So nothing to do with Koma!

 

Thx again, works great now  8)

Link to comment
  • 2 months later...

Installed KOMA, it created the dbs but still it is not updating the dbs with the media content.

 

Had a MySQL plugins working when I was on v5.

 

HOw can I investigate the problem? KODI logs?, I see nothing in the KOMA logs that would help me find the issue.

 

int eh adveancedsettings.xml, I use ip adresses, no names.

Link to comment

Installed KOMA, it created the dbs but still it is not updating the dbs with the media content.

 

Had a MySQL plugins working when I was on v5.

 

HOw can I investigate the problem? KODI logs?, I see nothing in the KOMA logs that would help me find the issue.

 

int eh adveancedsettings.xml, I use ip adresses, no names.

 

for koma you don't need to touch the advancedsettings file at all. it's set to use localhost which because the database is in the same container is the right address for it.

Link to comment
Installed KOMA, it created the dbs but still it is not updating the dbs with the media content.

 

Had a MySQL plugins working when I was on v5.

 

HOw can I investigate the problem? KODI logs?, I see nothing in the KOMA logs that would help me find the issue.

 

int eh adveancedsettings.xml, I use ip adresses, no names.

 

for koma you don't need to touch the advancedsettings file at all. it's set to use localhost which because the database is in the same container is the right address for it.

 

Did not change the advancedsettings.xml

Link to comment

hello,

I installed the koma docker but some things are unclear.

The mariaDB is working, I've been able to connect to the database and to attach my desktop's kodi to it.

The docker kodi seems ok too as i am able to connect through the webgui.

 

However, how am i suppose to manage the kodi settings? editing the xml files ?

I did not find any settings in the webgui nor in the android app.

 

thanks for your help

 

ps: the docker description says:

let it run for a couple of minutes

and then stop it

go to unraid terminal and issue this command

docker exec Koma createuser kodi kodi

where as it is impossible to run a docker exec koma while the docker is stopped. It is not a big deal but it could be disturbing for some person.

 

Link to comment

hello,

I installed the koma docker but some things are unclear.

The mariaDB is working, I've been able to connect to the database and to attach my desktop's kodi to it.

The docker kodi seems ok too as i am able to connect through the webgui.

 

However, how am i suppose to manage the kodi settings? editing the xml files ?

I did not find any settings in the webgui nor in the android app.

 

thanks for your help

 

ps: the docker description says:

let it run for a couple of minutes

and then stop it

go to unraid terminal and issue this command

docker exec Koma createuser kodi kodi

where as it is impossible to run a docker exec koma while the docker is stopped. It is not a big deal but it could be disturbing for some person.

 

you don't need to change any settings in the advancedsettings.xml for koma, it's preset to localhost, which is right because mariadb is in the same container.

 

i'll amend the description to stop/start.

Link to comment

ok I got that, however how can I configure the sources in kodi in order to get it to update my DB ?

I would like kodi to update the DB regularly or even maybe trigger it from sickrage and couch...

thank you.

 

scan the library in from another kodi instance, and triggering from couch and sickrage etc is as easy putting the IP address and port into their settings page as you would for a regular kodi instance.

 

remember to use the IP of the unraid box, and not localhost or 127.0.0.1

Link to comment

Hey SparkyBalls,

 

I am running into an issue... I installed your Koma docker, I attempted to log onto the webui and didnt know the ID and PWD, I read through this post and saw the command of

docker exec Koma createuser kodi kodi

When I enter this I get prompted for a password but then the root@tower:~# prompt comes up right away. I then tried entering the following (also found in this thread

docker exec -i -t Koma mysql -u root -p

 

I am prompted for a password. I tried "kodi" and received a message that the password for root@tower was incorrect, I tried again and entered the password for Root and was again told it was incorrect.

 

Any Ideas?

Link to comment

Hey SparkyBalls,

 

I am running into an issue... I installed your Koma docker, I attempted to log onto the webui and didnt know the ID and PWD, I read through this post and saw the command of

docker exec Koma createuser kodi kodi

When I enter this I get prompted for a password but then the root@tower:~# prompt comes up right away. I then tried entering the following (also found in this thread

docker exec -i -t Koma mysql -u root -p

 

I am prompted for a password. I tried "kodi" and received a message that the password for root@tower was incorrect, I tried again and entered the password for Root and was again told it was incorrect.

 

Any Ideas?

 

the webui user and pw is xbmc/xbmc

 

but it's practically useless, it has to be enabled for the container to work, but it really serves no useful purpose other than that.

Link to comment

 

 

the webui user and pw is xbmc/xbmc

 

but it's practically useless, it has to be enabled for the container to work, but it really serves no useful purpose other than that.

 

OK that worked...

 

I have never had a MySQL etc setup before.... how to I set up/configure the headless Kodi to auto scan for new files? can this be set up to run on a set schedule?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.