Recherche avancée

Médias (0)

Mot : - Tags -/tags

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (45)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (6301)

  • How to verify user permissions – Introducing the Piwik Platform

    9 novembre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to make your plugin multilingual). This time you’ll learn how to verify user permissions. For this tutorial you will need to have basic knowledge of PHP and the Piwik platform.

    When should a plugin verify permissions ?

    Usually you want to do this before executing any action – such as deleting or fetching data – and before rendering any sensitive information that should not be accessible by everyone. For instance in an API method or Controller action. You sometimes also need to verify permissions before registering menu items or widgets.

    How does Piwik’s user management work ?

    It is quite simple as it only differentiates between a few roles : View permission, Admin permission and Super User permission. If you manage multiple websites with Piwik a user can be assigned to different roles as a user might have no permission for some websites but view or admin permission for another set of websites.

    Worth mentioning is that roles inherit from each other. This means the role admin automatically includes the role view and a super user automatically covers the view and admin role.

    Getting started

    In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.

    Verifying user permissions

    To protect your data the platform offers many convenient methods in the \Piwik\Piwik class. There you will find methods that either start with check, is or has. While methods that start with check throw an exception in case a condition is not met, the other methods return a boolean true or false.

    Use methods that throw an exception if you want to stop any further execution in case a user does not have an appropriate role. The platform will catch the exception and display an error message or ask the user to log in.

    1. public function deleteAllMessages()
    2. {
    3.     // delete messages only if user has super user access, otherwise show an error message
    4.     Piwik::checkUserSuperUserAccess();
    5.  
    6.     $this->getModel()->deleteAllMessages();
    7. }

    Télécharger

    Use methods that return a boolean for instance when registering menu items or widgets.

    1. public function configureAdminMenu(MenuAdmin $menu)
    2. {
    3.     if (Piwik::hasUserSuperUserAccess()) {
    4.         $menu->addPlatformItem('Plugins', $this->urlForDefaultAction());
    5.     }
    6. }

    Télécharger

    It is important to be aware that just because the menu item won’t be displayed in the UI a user can still open the registered URL manually. Therefore you have to check for permissions in the actual controller action as well.

    View permission

    A user having a view permission should be only able to view reports but not make any changes apart from his personal settings. The methods that end with UserHasSomeViewAccess make sure a user has at least view permission for one website whereas the methods *UserHasViewAccess($idSites = array(1,2,3)) check whether a user has view access for all of the given websites.

    1. Piwik::checkUserHasSomeViewAccess();
    2.  
    3. Piwik::checkUserHasViewAccess($idSites = array(1,2,3));

    Télécharger

    As a plugin developer you would usually use the latter example to verify the permissions for specific websites. Use the first example in case you develop something like an “All Websites Dashboard” where you only want to make sure the user has a view permission for at least one website.

    Admin permission

    A user having an admin permission cannot only view reports but also change website related settings. The methods to check for this role are similar to the ones before, just swap the term View with Admin.

    1. Piwik::checkUserHasSomeAdminAccess();
    2.  
    3. Piwik::checkUserHasAdminAccess($idSites = array(1,2,3));

    Télécharger

    Super user permission

    A user having the super user permission is allowed to access all of the data stored in Piwik and change any settings. To check if a user has this role use one of the methods that end with UserSuperUserAccess.

    Piwik::checkUserHasSuperUserAccess();

    As a plugin developer you would check for this permission for instance in places where your plugin shows an activity log over all users or where it offers the possibility to change any system wide settings.

    Getting information about the currently logged in user

    Sometimes you might want to know which user is currently logged in. This can be useful if you want to persist user related information in the database or if you want to send an email to the currently logged in user. You can easily get this information by calling the following methods :

    1. $login = Piwik::getCurrentUserLogin()
    2. $email = Piwik::getCurrentUserEmail()

    Télécharger

    Advanced features

    Of course there is more that you can do. For instance you can verify whether a user is an anonymous user or whether a user has a specific role. You can also perform any operation in the context of a super user even if the current user does not have this role. Would you like to know more about those features ? Check out the Piwik class reference, the Security guide and the Manage Users user guide.

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.

  • play video with secure link in laravel ffmpeg

    1er mars 2023, par abc abc

    I convert my video file to m3u8 with ffmpeg and upload in download host.
I have no problem when I want to display Blade in Laravel without a secure link.

    


    Now, I am asking my friends to help me display those videos using a safe link, something like this link :

    


    https://dl4.your-domain.com/stream.m3u8?path=path-to-your-video-of-m3u8&expires=1677764366&signature=3e302aedefa62b4414beba4957927afa

    


    I did it myself without a secure link and got the output.
These are the routes I defined :

    


    Route::get('/video/secret/{key}', function ($key) {
    return Storage::disk('secrets')->download('29/' . $key);
})->name('video.key');
 
Route::get('/video/{playlist}', function ($playlist) {
    return FFMpeg::dynamicHLSPlaylist()
        ->fromDisk('static')
        ->open("stream/video/29/{$playlist}")
        ->setKeyUrlResolver(function ($key) {
            return route('video.key', ['key' => $key]);
        })
        ->setMediaUrlResolver(function ($mediaFilename) {
            return Storage::disk('static')->url("stream/video/29/{$mediaFilename}");
        })
        ->setPlaylistUrlResolver(function ($playlistFilename) {
            return route('video.playlist', ['playlist' => $playlistFilename]);
        });
})->name('video.playlist');


    


    This is the source of the video :

    


    <code class="echappe-js">&lt;script src=&quot;https://cdn.rawgit.com/video-dev/hls.js/18bb552/dist/hls.min.js&quot;&gt;&lt;/script&gt;&#xA;    &lt;script&gt;&amp;#xA;        document.addEventListener(&amp;#x27;DOMContentLoaded&amp;#x27;, () =&gt; {&amp;#xA;            const source = &quot;{{ route(&amp;#x27;video.playlist&amp;#x27;, [&amp;#x27;playlist&amp;#x27; =&gt; &amp;#x27;29.m3u8&amp;#x27;]) }}&quot;;&amp;#xA;            const video = document.querySelector(&amp;#x27;#video&amp;#x27;);&amp;#xA; &amp;#xA;            const defaultOptions = {};&amp;#xA; &amp;#xA;            if (!Hls.isSupported()) {&amp;#xA;                video.src = source;&amp;#xA;                var player = new Plyr(video, defaultOptions);&amp;#xA;            } else {&amp;#xA;                // For more Hls.js options, see https://github.com/dailymotion/hls.js&amp;#xA;                const hls = new Hls();&amp;#xA;                hls.loadSource(source);&amp;#xA; &amp;#xA;                // From the m3u8 playlist, hls parses the manifest and returns&amp;#xA;                        // all available video qualities. This is important, in this approach,&amp;#xA;                        // we will have one source on the Plyr player.&amp;#xA;                       hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {&amp;#xA; &amp;#xA;                           // Transform available levels into an array of integers (height values).&amp;#xA;                          const availableQualities = hls.levels.map((l) =&gt; l.height)&amp;#xA;                      availableQualities.unshift(0) //prepend 0 to quality array&amp;#xA; &amp;#xA;                          // Add new qualities to option&amp;#xA;                    defaultOptions.quality = {&amp;#xA;                        default: 0, //Default - AUTO&amp;#xA;                        options: availableQualities,&amp;#xA;                        forced: true,&amp;#xA;                        onChange: (e) =&gt; updateQuality(e),&amp;#xA;                    }&amp;#xA;                    // Add Auto Label&amp;#xA;                    defaultOptions.i18n = {&amp;#xA;                        qualityLabel: {&amp;#xA;                            0: &amp;#x27;Auto&amp;#x27;,&amp;#xA;                        },&amp;#xA;                    }&amp;#xA; &amp;#xA;                    hls.on(Hls.Events.LEVEL_SWITCHED, function (event, data) {&amp;#xA;                      var span = document.querySelector(&quot;.plyr__menu__container [data-plyr=&amp;#x27;quality&amp;#x27;][value=&amp;#x27;0&amp;#x27;] span&quot;)&amp;#xA;                      if (hls.autoLevelEnabled) {&amp;#xA;                        span.innerHTML = `AUTO (${hls.levels[data.level].height}p)`&amp;#xA;                      } else {&amp;#xA;                        span.innerHTML = `AUTO`&amp;#xA;                      }&amp;#xA;                    })&amp;#xA; &amp;#xA;                     // Initialize new Plyr player with quality options&amp;#xA;                     var player = new Plyr(video, defaultOptions);&amp;#xA;                 });&amp;#xA; &amp;#xA;            hls.attachMedia(video);&amp;#xA;                window.hls = hls;&amp;#xA;            }&amp;#xA; &amp;#xA;            function updateQuality(newQuality) {&amp;#xA;              if (newQuality === 0) {&amp;#xA;                window.hls.currentLevel = -1; //Enable AUTO quality if option.value = 0&amp;#xA;              } else {&amp;#xA;                window.hls.levels.forEach((level, levelIndex) =&gt; {&amp;#xA;                  if (level.height === newQuality) {&amp;#xA;                    console.log(&quot;Found quality match with &quot; &amp;#x2B; newQuality);&amp;#xA;                    window.hls.currentLevel = levelIndex;&amp;#xA;                  }&amp;#xA;                });&amp;#xA;              }&amp;#xA;            }&amp;#xA;        });&amp;#xA;    &lt;/script&gt;&#xA;

    &#xA;

    But these work without secure links and signatures.&#xA;I want to create a secure link using token, signature and expires for each part of the video.&#xA;It means to close the direct access on the download host and to access the video files only through Laravel.&#xA;Thank you if anyone knows how to help.

    &#xA;

    Something similar to the following link to display the video :

    &#xA;

    https://dl4.your-domain.com/stream.m3u8?path=path-to-your-video-of-m3u8&expires=1677764366&signature=3e302aedefa62b4414beba4957927afa

    &#xA;

  • Using ffmpeg with Python 2.7

    1er juillet 2015, par suffa

    I have been trying to install pyffmpeg in Python 2.7 unsuccessfully. I found a package for Python 2.6, but I can’t get it to work. So, I have been mulling around with 2.7. I’ve seen previous post from others on this site, but they have not helped. Does anyone have experience with this. Ultimately, I want to develop an wxPython app that converts video formats. Thanks

    Code that I ultimately wrote that worked for me (very rudimentary, but it works ....) :

    import wx
    import os
    import sys
    import time
    import datetime
    from wx.lib.delayedresult import startWorker



    class dConvert(wx.Frame):
       def __init__(self):
           wx.Frame.__init__(self, None, -1, 'd-Converter', size=(500, 310))
           panel = wx.Panel(self, wx.ID_ANY)#Creates a panel over the widget
           toolbar = self.CreateToolBar()
           toolbar.Realize()

           #Setup Menu
           #Setting up Menu
           menuFile = wx.Menu()
           menuFile.Append(1, "&amp;About...")
           menuFile.AppendSeparator()
           menuFile.Append(2, "E&amp;xit")
           menuBar = wx.MenuBar()
           menuBar.Append(menuFile, "&amp;File")

           panel.SetBackgroundColour('WHITE')

           menu2 = wx.Menu()
           menu2.Append(5, "&amp;.mpg to dvd", ".mpg to dvd")
           menu2.AppendSeparator()
           menu2.Append(wx.NewId(), "&amp;Options...", "Options...")
           menuBar.Append(menu2, "&amp;DVD")


           menu3 = wx.Menu()
           menu3.Append(7, "&amp;Audio/Video Trim")
           #menu3.AppendSeparator()
           menuBar.Append(menu3, "Media")

           self.SetMenuBar(menuBar)
           self.Bind(wx.EVT_MENU, self.OnAbout, id=1)
           self.Bind(wx.EVT_MENU, self.OnQuit, id=2)
           self.Bind(wx.EVT_MENU, self.OnDVD, id=5)
           self.Bind(wx.EVT_MENU, self.OnMedia, id=7)

           #Add icon to frame
           iconFile = "dconverter_image.jpg"
           icon1 = wx.Icon(iconFile, wx.BITMAP_TYPE_JPEG)
           self.SetIcon(icon1)


           self.statusbar = self.CreateStatusBar()
           self.statusbar.SetStatusText("Convert Audio &amp; Video")
           self.statusbar.SetFieldsCount(3)
           self.statusbar.SetStatusWidths([200, -2, -2])



           #Panel Text
           font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
           font2 = wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD)

           directory = wx.StaticText(panel, -1, 'Path: c:\\ffmpeg\\bin', (300, 13))
           directory.SetFont(font2)

           convertfile = wx.StaticText(panel, -1, 'File:', (270, 53))
           convertfile.SetFont(font)

           convertfile2 = wx.StaticText(panel, -1, 'Format:', (245, 83))
           convertfile2.SetFont(font)

           convertfile3 = wx.StaticText(panel, -1, 'Quality:', (244, 113))
           convertfile3.SetFont(font)

           convertfile4 = wx.StaticText(panel, -1, 'Presets:', (239, 143))
           convertfile4.SetFont(font)

           image_file = 'cd_rom.gif'
           bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
           panel.bitmap1 = wx.StaticBitmap(panel, -1, bmp1, (50, 30))



           self.formats1 = []


           #Select Media path    
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           #self.formats1 = []

           for filename in filelist:
               (head, filename) = os.path.split(filename)
               if filename.endswith(".avi") or filename.endswith(".mp4") or filename.endswith(".mpg") or filename.endswith(".m4A") or filename.endswith(".MTS") or filename.endswith(".flv") or filename.endswith(".mov") or filename.endswith(".mpeg4") or filename.endswith(".mpeg") or filename.endswith(".mpg2") or filename.endswith(".mkv") or filename.endswith(".m4v") or filename.endswith(".wav") or filename.endswith(".mp3"):
               self.formats1.append(filename)


           self.format_combo1=wx.ComboBox(panel, size=(140, -1),value='Select Media', choices=self.formats1, style=wx.CB_DROPDOWN, pos=(300,50))
           self.Bind(wx.EVT_COMBOBOX, self.fileFormats, self.format_combo1)


           #Media Formats
           self.formats2 = ['Select Format', '.avi','.mpeg','.mp4','.flv','.mov','.m4a','.m4v','.mkv','.mpeg4','.mpg','.mpg2','.mp3','.ogg','.wav','.wma']

           self.format_combo2=wx.ComboBox(panel, size=(100, -1),value='Select Format', choices=self.formats2, style=wx.CB_SORT, pos=(300,81))

           #Media Quality
           self.formats3 = ['-sameq','-qmax']
           self.format_combo3=wx.ComboBox(panel, size=(100, -1),value='Select Quality', choices=self.formats3, style=wx.CB_DROPDOWN, pos=(300,111))



           #-qmax settings
           self.formats4 = ['1','2','3','4','5','6','7','8']
           self.format_combo4=wx.ComboBox(panel, size=(30, -1),value='0', choices=self.formats4, style=wx.CB_DROPDOWN, pos=(405,111))
           self.format_combo4.Disable()


           #Media Quality
           self.formats5 = ['Select Preset','video to mp3']
           self.format_combo5=wx.ComboBox(panel, size=(100, -1),value='Select Preset', choices=self.formats5, style=wx.CB_DROPDOWN, pos=(300,141))

           #Bit rate
           self.formats6 = ['128000', '160000', '180000', '192000']
           self.format_combo6=wx.ComboBox(panel, size=(47, -1),value='k/bs', choices=self.formats6, style=wx.CB_DROPDOWN, pos=(405,141))
           self.format_combo6.Disable()






           #Convert Button
           self.button = wx.Button(panel, label="Convert", pos=(300, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.convertButton, self.button)

           #Abort Button
           self.button2 = wx.Button(panel, label="Abort", pos=(385, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.OnAbortButton, self.button2)
           self.button2.Disable()

           #Refresh Button
           self.button3 = wx.Button(panel, label="Refresh", pos=(215, 171), size=(80, 20))
           self.Bind(wx.EVT_BUTTON, self.file_refresh, self.button3)


           #ComboBox Event
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox, self.format_combo3)
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox2, self.format_combo5)
           self.Bind(wx.EVT_COMBOBOX, self.OncomboBox3, self.format_combo2)



       def file_refresh(self, e):
           self.format_combo1.Clear()
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           for m_files in filelist:
               if m_files.endswith(".avi") or m_files.endswith(".mp4") or m_files.endswith(".mpg") or m_files.endswith(".m4A") or m_files.endswith(".MTS") or m_files.endswith(".flv") or m_files.endswith(".mov") or m_files.endswith(".mpeg4") or m_files.endswith(".mpeg") or m_files.endswith(".mpg2") or m_files.endswith(".mkv") or m_files.endswith(".m4v") or m_files.endswith(".wav") or m_files.endswith(".mp3"):
               self.format_combo1.Append(m_files)



       def file_rename(self, f_name):
           ts = time.time()
           #Capture readable timestamp
           st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H-%M-%S')
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()

           #get file extenstion from original file
           #fileName, fileExtension = os.path.splitext(wrkdir + '\\' + f_name)

           #add file extension to timestamp
           new_file = st

           return new_file



       def fileFormats(self, e):
           myFormats = {'audio': ('Select Format', '.m4a', '.mp3', '.ogg', '.wav', '.wma'), 'video': ('Select Format', '.avi', '.flv', '.mkv', '.m4v', '.mov', '.mpg', '.mpg2', '.mpeg4', '.mp4', '.mpeg')}
           bad_file = ['Media not supported']
           myFile = self.format_combo1.GetValue()
           f_exten = (x for x in myFormats['audio'] + myFormats['video'] if myFile.endswith(x))
       extension = f_exten.next()

           if extension in myFormats['audio']:
               self.format_combo2.SetItems(myFormats['audio'])

           elif extension in myFormats['video']:
               self.format_combo2.SetItems(myFormats['video'])
           else:
               self.format_combo2.SetItems(bad_file)


       def OnQuit(self, event):
           self.Close(True)

       def OnAbout(self, event):
           wx.MessageBox("d-Converter 1.0\n\n Developer: D.Monroe\n\nCopyright 2012",
                   "About d-Converter", wx.OK | wx.ICON_INFORMATION, self)


       def OncomboBox(self, e):
           quality=self.format_combo3.GetValue()
           if quality == '-qmax':
               self.format_combo4.Enable()

           else:
               self.format_combo4.Disable()



       def OncomboBox2(self, e):
           quality=self.format_combo5.GetValue()
           if quality != 'Select Preset':
               self.format_combo1.Enable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()
               self.format_combo6.Enable()

           elif quality == 'Select Preset':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Disable()
               self.format_combo5.Enable()
               self.format_combo6.Disable()

           elif quality == 'video to mp3':
               self.format_combo6.Enable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()

       def OncomboBox3(self, e):
           v_format=self.format_combo2.GetValue()
           if v_format != 'Select Format':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Enable()
               self.format_combo5.Disable()
               self.format_combo6.Disable()

           elif v_format == 'Select Format':
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo4.Disable()
               self.format_combo5.Enable()
               self.format_combo6.Disable()





       def OnMedia(self, e):
           pass

       def OnDVD(self, e):
           """ Select a directory to search"""
           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()
           filelist = os.listdir(wrkdir)
           progdir = 'c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '
           prog_dir = ' -target '
           progdir3 = '-dvd -ac 2 '
           vid_format = '.mpg'


           sampleList = []
           for filename in filelist:
              (head, filename) = os.path.split(filename)
              if filename.endswith(".avi") or filename.endswith(".flv") or filename.endswith(".mpeg") or filename.endswith(".mp4") or filename.endswith(".mov") or filename.endswith(".mpg2"):
               sampleList.append(filename)

           dlg = wx.SingleChoiceDialog(
                  self, "Files in c:\\ffmpeg\\bin", 'Select video to convert',
              sampleList,
              wx.CHOICEDLG_STYLE
              )

           if dlg.ShowModal() == wx.ID_OK:
               cur_item = dlg.GetStringSelection()
               s_string = cur_item
               #f_string = self.file_rename(s_string)
               f_string = s_string.replace(' ', '')





           dlg.Destroy()


           dlg2 = wx.SingleChoiceDialog(
                  self, "Files in c:\\ffmpeg\\bin", 'Select video standard ',
              ["pal", "ntsc"],
              wx.CHOICEDLG_STYLE
              )

           if dlg2.ShowModal() == wx.ID_OK:
               cur_item2 = dlg2.GetStringSelection()
               s_string2 = cur_item2
               self.button.Disable()
               self.button2.Enable()
               self.format_combo1.Disable()
               self.format_combo2.Disable()
               self.format_combo3.Disable()
               self.format_combo4.Disable()
               self.format_combo5.Disable()
               self.format_combo6.Disable()
               startWorker(self.LongTaskDone, self.LongTask4, wargs=(progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format))


           dlg2.Destroy()






       def convertButton(self, e):
           unit1 = self.format_combo1.GetValue()
           unit2 = self.format_combo2.GetValue()
           unit3 = self.format_combo3.GetValue()
           unit4 = None
           unit5 = self.format_combo5.GetValue()
           bitRate = self.format_combo6.GetValue()
           unit6 = bitRate
           if unit3 == '-qmax':
               unit4 = self.format_combo4.GetValue()
           else:
               pass

           os.chdir("c:\\ffmpeg\\bin")
           wrkdir = os.getcwd()

           newfile = unit1



           #stripped = os.path.splitext(newfile)[0] # Updated 9/26/2013 to strip extension.
           #stripped = newfile.strip('mpeg3kaviovfl4w2c.') #Strips the extension from the original file name
           stripped = self.file_rename(newfile)

           #os.rename(newfile, newfile_f)



           progname='c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '

           preset1_a='-vn -ar 44100 -ac 2 -ab'
           preset1_b='-f mp3 '
           preset_mp3='.mp3'







            if (unit1 == 'Select Media' or unit1 == ''):
                       amsg = wx.MessageDialog(None, 'You must select a media file!', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()



            elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'Select Preset'):

                if (unit2 == 'Select Format' or unit2 == ''):
                   amsg = wx.MessageDialog(None, 'You must select a format', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()

                   self.format_combo3.Enable()
                   self.format_combo4.Enable()
                   self.format_combo5.Enable()

               else:
                   pass

               if (unit3 == 'Select Quality' or unit3 == ''):
                   amsg = wx.MessageDialog(None, 'You must select quality', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()


               elif (unit3 == '-qmax'):
                   if (unit4 == '0' or unit4 == ''):
                       amsg = wx.MessageDialog(None, 'You must select number between 1-8.', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()
                   else:
                       self.button.Disable()
                       self.button2.Enable()
                       pass

               else:
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   startWorker(self.LongTaskDone, self.LongTask, wargs=(progname,wrkdir,unit1,unit3,stripped,unit2))





           elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'video to mp3'):
               if unit6 == 'k/bs' or unit6 == None:
                   amsg = wx.MessageDialog(None, 'You must select a bit rate.', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()

               else:
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   self.format_combo6.Disable()
                   startWorker(self.LongTaskDone, self.LongTask3, wargs=(progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3))











       def LongTask(self, progname, wrkdir, unit1, unit3, stripped, unit2):
           convert_file1 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + stripped + unit2
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file1)
           print convert_file1





       def LongTask2(self, progname, wrkdir, unit1, unit3, unit4, stripped, unit2):
           convert_file2 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + unit4 + ' ' + stripped + unit2
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file2)


       def LongTask3(self, progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3):
           convert_file3 = progname + wrkdir + '\\' + unit1 + ' ' + preset1_a + ' ' + unit6 + ' ' + preset1_b + stripped + preset_mp3
           self.statusbar.SetStatusText("Converting: " + unit1 + "...")
           os.system(convert_file3)

       def LongTask4(self, progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format):
           #convert_file4 = progdir + wrkdir + '\\' + s_string + prog_dir + s_string2 + progdir3 + s_string.strip('mpegaviw24ofl.') + vid_format
           convert_file4 = progdir + f_string + prog_dir + s_string2 + progdir3 + f_string.strip('mpegaviw24ofl.') + vid_format
           self.statusbar.SetStatusText("Converting: " + f_string + "...")
           os.system(convert_file4)
           print convert_file4



       def LongTaskDone(self, result):
           r = result.get()
           if r:
               amsg = wx.MessageDialog(None, 'Aborted!', 'Media Converter', wx.ICON_INFORMATION)
               self.statusbar.SetStatusText("Convert Aborted ...")
               amsg.ShowModal()
               amsg.Destroy()
               self.LongTask.terminate()
           else:
               self.statusbar.SetStatusText("Done ...")
               emsg = wx.MessageDialog(None, 'Finished Converting!', 'Media Converter', wx.ICON_INFORMATION)
               emsg.ShowModal()
               emsg.Destroy()
               self.format_combo1.Enable()
               self.format_combo2.Enable()
               self.format_combo3.Enable()
               self.format_combo5.Enable()
               self.format_combo4.Disable()
               self.format_combo6.Disable()
               self.button.Enable()
               self.button2.Disable()
               self.shouldAbort = False
           """self.progress_bar.SetValue(0)
           self.progress_bar.Hide()"""



       def OnAbortButton(self, e):
           endprogram = 'c:\\Windows\\System32\\taskkill /IM cmd.exe'
           os.system(endprogram)
           self.format_combo1.Enable()
           self.format_combo2.Enable()
           self.format_combo3.Enable()
           self.format_combo5.Enable()
           self.button.Enable()




    if __name__ == '__main__':
       app = wx.PySimpleApp()
       frame = dConvert()
       frame.SetSizeHints(500,310,500,310)
       frame.Show()
       app.MainLoop()