Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Database and file sharing program using vb.net

I'm trying to build a sort of Plex media server knock off for a class project. I don't intend to copy any of the big features of plex like matching media data or having its own built in media player. I just want to build a server application that hosts a database list and a bunch of media files and a client application that will connect to the server, display the hosted database file and update a picture box whenever a data grid view selection is changed. Attached is some of the code I wrote along with a screenshot of the project to get an idea of what I want to do over the network.

Public Class Movies
    Dim videoString As String
    'tv shows connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="|DataDirectory|\TV Shows database.accdb"
    'movies connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="|DataDirectory|\Movies Database.accdb"
    Private Sub btnEdit_Click(sender As Object, e As EventArgs) Handles btnEdit.Click
        EditMovies.Show()
    End Sub
    Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
        Me.Hide()
        WelcomePage.Show()
    End Sub
    Public Sub Movies_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Movies_DatabaseDataSet2.Movies' table. You can move, or remove it, as needed.
        Me.MoviesTableAdapter2.Fill(Me.Movies_DatabaseDataSet2.Movies)

    End Sub
    Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
        Dim posterString As String = DataGridView1.Item("Poster", DataGridView1.CurrentRow.Index).Value.ToString
        '"Poster" refers to the dataGridView column
        PictureBox1.Image = Image.FromFile(posterString)

        videoString = DataGridView1.Item("Location", DataGridView1.CurrentRow.Index).Value.ToString
    End Sub
    Private Sub btnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click
        Process.Start(videoString)
    End Sub
End Class

 

Screenshot 2021-04-19 154544.jpg

Link to post
Share on other sites
26 minutes ago, hhamama66 said:

I'm trying to build a sort of Plex media server knock off for a class project. I don't intend to copy any of the big features of plex like matching media data or having its own built in media player. I just want to build a server application that hosts a database list and a bunch of media files and a client application that will connect to the server, display the hosted database file and update a picture box whenever a data grid view selection is changed. Attached is some of the code I wrote along with a screenshot of the project to get an idea of what I want to do over the network.


Public Class Movies
    Dim videoString As String
    'tv shows connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="|DataDirectory|\TV Shows database.accdb"
    'movies connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="|DataDirectory|\Movies Database.accdb"
    Private Sub btnEdit_Click(sender As Object, e As EventArgs) Handles btnEdit.Click
        EditMovies.Show()
    End Sub
    Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
        Me.Hide()
        WelcomePage.Show()
    End Sub
    Public Sub Movies_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Movies_DatabaseDataSet2.Movies' table. You can move, or remove it, as needed.
        Me.MoviesTableAdapter2.Fill(Me.Movies_DatabaseDataSet2.Movies)

    End Sub
    Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
        Dim posterString As String = DataGridView1.Item("Poster", DataGridView1.CurrentRow.Index).Value.ToString
        '"Poster" refers to the dataGridView column
        PictureBox1.Image = Image.FromFile(posterString)

        videoString = DataGridView1.Item("Location", DataGridView1.CurrentRow.Index).Value.ToString
    End Sub
    Private Sub btnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click
        Process.Start(videoString)
    End Sub
End Class

 

Screenshot 2021-04-19 154544.jpg

Seems like a statement rather than a question.

Life is like a bowl of chocolates: there are all these little crinkly paper cups everywhere.

Link to post
Share on other sites
Just now, Bombastinator said:

Seems like a statement rather than a question.

My apologies. How do I create a server and how do I create a client application that will connect to the server and send requests to view the database file and open the media files?

Link to post
Share on other sites
15 hours ago, hhamama66 said:

My apologies. How do I create a server and how do I create a client application that will connect to the server and send requests to view the database file and open the media files?

Here's 2 of the easiest options :

1 - Code a server application with socket and make the client use his socket to connect and request the data

2 - Much easier, build a simple WCF Service for the server and host it in IIS. The client will connect to the service and call the proper method to get the list.

 

Important note that socket is very complicated and that in the end I assume you will want to stream that content and you wont have the choice but go the socket route. This also include parsing the video file and streaming with the proper protocol so a tv can connection and read the content.

Link to post
Share on other sites
1 hour ago, Franck said:

Here's 2 of the easiest options :

1 - Code a server application with socket and make the client use his socket to connect and request the data

2 - Much easier, build a simple WCF Service for the server and host it in IIS. The client will connect to the service and call the proper method to get the list.

 

Important note that socket is very complicated and that in the end I assume you will want to stream that content and you wont have the choice but go the socket route. This also include parsing the video file and streaming with the proper protocol so a tv can connection and read the content.

I understand this will be a fairly complicated project, but I'm willing to try and learn and I have my professor to help me iron out the bugs. I just need to be pointed in the right direction as my coding class doesn't cover anything networking in vb.net. The hardest thing we've done is databases and I know how to connect local databases, create insert, delete, update statements etc.

So since coding the server application with sockets will allow me to stream the video file, I'm gonna go with that. I've been trying to look up how to host a database file locally and came up with nothing aside from someone showing how to connect to a SQL server database over the internet. I don't want to have to dabble with SQL server settings as the project requires that if I make an application, it has to be portable so my professor can execute it on his own device without any trouble. You mentioned TV connections, but honestly I'm not interested in that (maybe if I choose to work on this later in my own free time, I'll revisit this idea). I just want to focus on creating a windows server and client at the moment.

 

For the record, my database file is an Access db at the moment. If I cannot host the database with a SQL server or Access db file, is there a way to create a self contained database within the vb.net application?

Link to post
Share on other sites
18 minutes ago, hhamama66 said:

For the record, my database file is an Access db at the moment. If I cannot host the database with a SQL server or Access db file, is there a way to create a self contained database within the vb.net application?

Can you self contain ? Yes.

Is it beginner stuff ? it's not.

 

Are there problems with Access over SQL ? yes, access is limited in concurrent connection.

What if I don't want to deal with any of this and keep it as easy as possible ? Use very simple database that isn't far from what you know and easy for any average joe to use.

 

What can you use ? The answer is easy, use SQLlite from https://www.sqlite.org/index.html (With visual studio it's probably easier to use the nuget package)

Then download the GUI https://sqlitestudio.pl/. That GUI is very simple. It will allow to create a database and edit, query, test, whatever in 1 simple small application.

 

SQLLight is a DLL that allow to connect to a SQLLite database which is a single .db file.

Unlike MSSQL it doesn't not require a server edition of windows and is also portable.

Also much better option than MySQL for beginner. All it really have is Tables and that's it. Nothing fancy, no socket connection, multiple port access, no backup, no scheduling task, no user, nothing. a DB in it's purest form. You have limitation but it's extremely unlikely you will hit them.

Link to post
Share on other sites
47 minutes ago, Franck said:

Can you self contain ? Yes.

Is it beginner stuff ? it's not.

 

Are there problems with Access over SQL ? yes, access is limited in concurrent connection.

What if I don't want to deal with any of this and keep it as easy as possible ? Use very simple database that isn't far from what you know and easy for any average joe to use.

 

What can you use ? The answer is easy, use SQLlite from https://www.sqlite.org/index.html (With visual studio it's probably easier to use the nuget package)

Then download the GUI https://sqlitestudio.pl/. That GUI is very simple. It will allow to create a database and edit, query, test, whatever in 1 simple small application.

 

SQLLight is a DLL that allow to connect to a SQLLite database which is a single .db file.

Unlike MSSQL it doesn't not require a server edition of windows and is also portable.

Also much better option than MySQL for beginner. All it really have is Tables and that's it. Nothing fancy, no socket connection, multiple port access, no backup, no scheduling task, no user, nothing. a DB in it's purest form. You have limitation but it's extremely unlikely you will hit them.

So, SQLlite is literally just a self contained database file without any of the extra features and complexity of MSSQL? Awesome. I would have to rebuild the database file and reconnect in visual studio, but that won't take long. So now the question is, how do I take that database and use it to make a server out of it? I want to allows clients to connect to that database, display it and update the picture box with the video poster every time a selection is changed. I then want the client to be able to request the files located on the server and play them using the local default media player (in my case, VLC).

Link to post
Share on other sites
55 minutes ago, hhamama66 said:

So, SQLlite is literally just a self contained database file without any of the extra features and complexity of MSSQL? Awesome. I would have to rebuild the database file and reconnect in visual studio, but that won't take long. So now the question is, how do I take that database and use it to make a server out of it? I want to allows clients to connect to that database, display it and update the picture box with the video poster every time a selection is changed. I then want the client to be able to request the files located on the server and play them using the local default media player (in my case, VLC).

Before even touching the database you have all the socket work to do. Once the socket system is working (multi threading, connection accepted, connection dropped, etc) then you can start implementing your commands. You will need the client to send a specific data that the server will interpret as a "give me the list of movies". Only then you will do your query, format the data in a way you can send it back to the client. Then the client need to know that the data coming back is a set of data and reconstruct it properly. Then you can fill in a UI.

 

To stream to VLC you will need to search how to specially build the content delivery network to stream to VLC. Delivering stream that is another server application that would be spawn for each listener. You will encounter problem when 2 people try to read the same file at the same time so you will need a kind of sharing module of some sort that will have a single lock on the file and the streams will request that process for specific byte ranges to stream to it's client.

 

I might have code somewhere for WindowsMediaPlayer as I did something similar for a company back then. All I worked on is the streamer, I didn't had any frontend it was all streams over http paths. It might be a lot to ingest as it took me and my colleague 2 years to complete so there is tons of lines of code. I'll check tonight what I still have.

Link to post
Share on other sites
2 minutes ago, Franck said:

Before even touching the database you have all the socket work to do. Once the socket system is working (multi threading, connection accepted, connection dropped, etc) then you can start implementing your commands. You will need the client to send a specific data that the server will interpret as a "give me the list of movies". Only then you will do your query, format the data in a way you can send it back to the client. Then the client need to know that the data coming back is a set of data and reconstruct it properly. Then you can fill in a UI.

 

To stream to VLC you will need to search how to specially build the content delivery network to stream to VLC. Delivering stream that is another server application that would be spawn for each listener. You will encounter problem when 2 people try to read the same file at the same time so you will need a kind of sharing module of some sort that will have a single lock on the file and the streams will request that process for specific byte ranges to stream to it's client.

What about the way windows shares folders over LAN? I've played videos over my LAN before on a shared folder with VLC. Is there something about that process that could be relevant to this project?

Link to post
Share on other sites
11 minutes ago, hhamama66 said:

What about the way windows shares folders over LAN? I've played videos over my LAN before on a shared folder with VLC. Is there something about that process that could be relevant to this project?

that is not really streaming yourself, you literally open the video in ram locally. If you want to do that just put the sqllite databas on that network drive and use it directly from each client app and you do not need any socket client server.

 

Link to post
Share on other sites
3 minutes ago, Franck said:

that is not really streaming yourself, you literally open the video in ram locally

Ok, so VLC streaming it is. You mentioned that the first thing I had to do was create a socket for the server/client to send and receive data. Where do I start?

Link to post
Share on other sites
15 hours ago, hhamama66 said:

Ok, so VLC streaming it is. You mentioned that the first thing I had to do was create a socket for the server/client to send and receive data. Where do I start?

Well it is technically streaming but not like you think. by default streaming you CANT pause, rewind, fast forward. Streaming is like live tv. If you can pause, catch up, rewind this is extra features added on top of streaming. What do you want to do exactly ?

Link to post
Share on other sites
4 hours ago, Franck said:

Well it is technically streaming but not like you think. by default streaming you CANT pause, rewind, fast forward. Streaming is like live tv. If you can pause, catch up, rewind this is extra features added on top of streaming. What do you want to do exactly ?

This is exactly what I want to do. I want to be able to pause, catch up and rewind the video.

Link to post
Share on other sites

If you use VLC you gotta first learn if it can do it and if yes how you need to provide that information. I personally have no clue. On my end i had to create my own video player and I used direct2d.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×