Categories
Fedora Music Other

Icecast Now Playing WordPress Widget Script

Before moving to WordPress from BlogEngineDotNet I had a widget that made a call to a specially created Icecast XSL file to display the current playing track title in a Widget.  This worked great, but it was static and wouldn’t update if the track changed.  Migrating to WordPress, I wanted to achieve the same track playing information but up the game with it updating to display new track information.  The latest Icecast server has built in metadata report in JSON format now so I wanted to use this over parsing an XSL file. This took me roughly about a day and a half to complete, mostly due to nearly all examples of parsing JSON with Javascript do not work and I know little Javascript. Here is an overview of the process invovled.

  • Configure Icecast headers and SSL certificates
  • Insert Javascript in headers.php
  • Insert HTML in Widget for display
Configure Icecast

You can skip this part if you are not using SSL. Also note Apache and Icecast are running on the same server. Since my site defaults to SSL (https) I have to configure Icecast for SSL.

The first step is to create the proper SSL certificate file format that Icecast uses. It requires a Public/Private keypair file. I used my Let’s Encrypt certificates and concatenated them together into one file.

cd /usr/share/icecast
cat /etc/letsencrypt/live/autonarcosis.com/cert.pem > icecast.pem
cat /etc/letsencrypt/live/autonarcosis.com/privkey.pem >> icecast.pem
chown icecast.icecast icecast.pem
chmod go-r icecast.pem

Now to edit the /etc/icecast.xml configuration file to enable an SSL port and point to the icecast.pem file. Create a second listen-socket container with a different port and enable SSL. Insert http-headers container before paths container for access control (this gives permission for the javascript to access the JSON data).  Put the ssl-certificate path setting within the existing paths container.

<listen-socket>
     <port>8002</port>
     <ssl>1</ssl>
</listen-socket>

<http-headers>
    <header name="Access-Control-Allow-Origin" value="*" />
</http-headers>
<paths>
     <ssl-certificate>/usr/share/icecast/icecast.pem</ssl-certificate>
</paths

Save the icecast.xml file. Enable the new port in the firewall.

firewall-cmd --permanent --add-port=8002/tcp
firewall-cmd --reload

Restart Icecast, which will now be listening on an SSL port.

systemctl restart icecast.service

You can view Icecast error log file /var/log/icecast/error.log to see if the SSL certificate loaded properly.  You should see something similar to this.

[2016-03-11  15:41:45] INFO connection/get_ssl_certificate SSL certificate found at /usr/share/icecast/icecast.pem
[2016-03-11  15:41:45] INFO connection/get_ssl_certificate SSL using ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA2
56:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-R
SA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SH
A384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA25
6:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-S
HA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-S
HA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
Configure WordPress

Now it is time to configure WordPress.  Below is the Javascript that I hacked together to pull the Icecast metadata from the data feed in JSON format. This is WordPress modified Javascript and will not work outside WordPress.  Place this Javascript in the HEAD section of your themes headers.php.

<script type="text/javascript">
function radioTitle() {
 
jQuery.ajax({
        url: "https://www.autonarcosis.com:8002/status-json.xsl",
        //force to handle it as text
        dataType: "text",
        async: true,
        success: function(data) {
                        
        //data downloaded so we call parseJSON function 
        //and pass downloaded data
        var json = jQuery.parseJSON(data);
        //now json variable contains data in json format
        //let's display a few items
        // this is the element we're updating that will hold the track title
            jQuery('#track-title').text(json.icestats.source.title);
        // this is the element we're updating that will hold the listeners count
            jQuery('#listeners').text(json.icestats.source.listeners);            
       }
     });
   };
   
jQuery(document).ready(function(){

        setTimeout(function(){radioTitle();}, 2000);
        // we're going to update our html elements / player every 15 seconds
        setInterval(function(){radioTitle();}, 15000); 

});

</script>

Add the HTML to the widget so the information will be displayed.

<p>
</br>
Listeners: <span id="listeners">00</span></br>
Current track: <span id="track-title">LIVE</span>
</p>

That’s all there is to it. There could possibly be a better way or function to do this.

I used this blog entry as a base for figuring this out; https://linge-ma.ws/update-listeners-track-on-a-website-using-icecast-jsonp-and-jquery/

Categories
Fedora Other Sendmail

Sendmail – How To Disable IPv6 When Sending/Relaying

Well, we learned how to configure Sendmail to send to a specific IP address on a per domain basis. Google and it’s business service e-mail is now by default publishing IPv6 addresses for MX records, it’s almost impossible to do a per domain setup.  We do not want to disable IPv6 entirely on the server, but Sendmail keeps sending out via IPv6. How the hell do you make it stop!  It’s quite simple but just a refresher since this is a configuration that is out of sight and mind.  Remember that Sendmail is really two things. A Daemon (the part that listens for incoming mail) and a Client (the part that sends/relays e-mail). Naturally you have the DAEMON settings by default, but not the CLIENT settings.  So here we go.

I have only found one forum post regarding the proper solution to this problem.  It appears not to be properly documented and possibly this is changed behavior in a recent update. However, it does make sense.  Essentially you need to tell the IPv6 stack to use your IPv4 address.

Edit /etc/mail/sendmail.mc

Look for

DAEMON_OPTIONS(`Port=smtp,Addr=xxx.xxx.xxx.xxx, Name=MTA')dnl

Below the above line add this;

CLIENT_OPTIONS(`Family=inet6,Addr=::ffff:xxx.xxx.xxx.xxx')dnl

Save the file, make the db files and restart Sendmail.

Now, Sendmail will use IPv4 for it’s CLIENT operations.

 

 

Categories
Other

Windows 10 – DVD Play Back – History Doesn’t Exist With Neck Beards.

With the Windows 10 release we are now getting a ton of neck beard ding dong click bait blog posts about it.  The big one making the rounds this week is how Windows 10 doesn’t include the ability to play DVD’s and how it’s some sort of evil thing that Microsoft is charging money for the ability to do so.  DVD play back requires the MPEG2 decoder which requires a license.

Welcome to the No History Neck Beards.  Seeing as we will ignore the entire history of the Windows operating system.  Microsoft Windows has never included in the MPEG2 decoder.  It ALWAYS has been an add on.  The only Windows editions that included this were the Media Center Editions, in which you most likely paid just a little bit more for the license to the MPEG2 decoder.  It is possible that many pre-packaged computers from HP, Compaq, Dell had the decoder included because a third party DVD player was installed. Of course our savior neck beards won’t differentiate from that.

Categories
Fedora Other Sendmail

Sendmail – How To Deliver To IPv4 Address Per Domain

More mail servers are now accepted e-mail via IPv6.  I have had a dynamically assigned IPv6 block on my Comcast Business account for awhile and I have let Sendmail decide what to use, and about 99.9% of mail is delivered via IPv4.  Just recently it appears Comcast has assigned an IPv6 MX record for their mail server. My Sendmail picked this up and now happily attempts to deliver the mail via the IPv6 address.  Unfortunately, it is immediately rejected due to the IPv6 address does not have a PTR record.  Of course Comcast Business is far behind on assigning IPv6 blocks so there is no way to get a static IPv6 block and a PTR entry.

How do I get Sendmail to deliver to the IPv4 address instead?  It’s called the mailertable feature..  You will need this feature enabled in your sendmail.mc file. Most likely it is already enabled.

/etc/mail/sendmail.mc

FEATURE(`mailertable')

 

Now you need to make an entry into the mailertable file with the domain and IPv4 address. In order to get the IPv4 MX address for the domain you can do so by using the host command. We first look up the main domain name to get the MX records. Then lookup the IPv4 address for the MX record.  We now have the IPv4 address to where we want to deliver the mail.

[root@superstar ~]# host comcast.net
comcast.net has address 69.252.80.75
comcast.net mail is handled by 5 mx2.comcast.net.
comcast.net mail is handled by 5 mx1.comcast.net.
[root@superstar ~]# host mx1.comcast.net
mx1.comcast.net has address 96.114.157.80
mx1.comcast.net has IPv6 address 2001:558:fe16:1b::15

 

We now add these lines to our mailertable file.

/etc/mail/mailertable

.comcast.net     esmtp:[96.114.157.80]
comcast.net     esmtp:[96.114.157.80]

 

Don’t forget to issue make to update the db files for Sendmail to see the changes to the mailertable file. And then restart Sendmail.  It will now deliver to the specific IPv4 address.

[root@superstar mail]# make
[root@superstar mail]# service sendmail restart
Redirecting to /bin/systemctl restart  sendmail.service
You bet there is a catch! If the IPv4 address changes, you will need to manually make the change.
That’s it all there is to this. Sendmail is now delivering to the IPv4 address.
Categories
BlogEngineDotNet Other

BlogEngine – mod_security makes it angry

I have noticed a lot of posts on the BlogEngine forum with users having a lot of problems within the Admin area. One even points out the 405 error which is one of the default errors of the Web Application Firewall mod_security. Which works great in IIS.  I suspect a lot of people are not aware that there is a version of mod_security for IIS.  And so, people constantly search for the solution to their problem when it’s glaring them right in the face.  That is, if you know what you are looking for. Hence this post.  If you get a “405 Method Not Allowed” error, most likely the mod_security module is enabled.  I have found that the default rules that come with mod_security are pretty much incompatible with BlogEngine and I have to disable the module in order to get it working.  Otherwise you will need to disable a vast amount of rules in order to get the application functioning properly.  It will be a monumental task in creating a BlogEngine ruleset for mod_security. Hopefully some day in most likely an alternate universe will someone sit down and create a ruleset for it.

Categories
BlogEngineDotNet Other

Updating BlogEngine 3.x – Errors Of The Ill Thought Out

When updating BlogEngine 3.x with the new updater you may run into some snags like I did.  There are some improvements, yet some are ill thought out unfortunately.  The first thing I ran into is that the Update process backs up your site. The problem with this is you may have a large amount of data in your media folder.  The backup process cannot handle more than a few megabytes of files in this folder until it will fail with an error on the 4th step as “The directory is not empty”.  If you get this error, most likely you have too much data to backup in your media folder.  I had several gigabytes of video files in the folder which resulted in this error.  To correct the problem, back up your media folder and remove the files from it, then proceed with the update.  Once the update is completed you can put your media files back.

Also note that if you are using Chrome, once the update is complete, you may need to delete the browsing history and restart Chrome.  I had to do this in order to get the Administration menu working properly.

Categories
Other

We Know You’re Lying

People seem to not want to believe that there are technologically minded people, and those people have been around for a lot longer than they want to believe.  Time and again I come across individuals that prescribe to the idea that I can just make shit up about what I am doing online and it will be the truth.  Cause, you know, the Internet is magic and just works, or something.  It works because thousands of dedicated people slave behind computers and various network devices to make it work.  Those people, monitor and keep track of what their devices are doing to make sure they are doing what they are supposed to.  So, when those brilliant lying people say things like “I sent that e-mail last night!”. “I called you multiple times over the week!”. We know you are lying!  Every service on the Internet has meticulous log files that tell us what the service is doing and who it’s doing it with. We trust the devices we use and maintain everyday over the lying asshole douche bag.  

Categories
Other

Importing Video Tapes – DV Files and FFMPEG

I’ve been working on importing all my old VHS and 8mm video tapes into my computer.  It’s always been fairly straight forward process of importing the video, originally when it was composite video being inputted it was in the form of an Uncompressed AVI file.  And then you’d convert it over to whatever media format you wanted.  Long ago I had chosen the Real Media file format. It had multiple bit rate encoding in a single file. This was required due to the various connectivity speeds everyone had back then.  From 28k Dialup to 1mbit connections.  It worked really well and then the Real Media format was pushed out for more wide spread and open source accessible media file formats. This is what happened with most of all the video files I had online.  They were all in some obsolete format and there wasn’t anything that could convert the Real Media files.  Which in turn were low resolution already.

I had started importing my video tapes back in 2011 via Firewire port and the pass through option on my Sony video camera.  This worked really well and unfortunately that computer failed and the replacement one no longer had a Firewire port.  So, I finally picked up a Firewire port at the beginning of this month and began the process where I had left off.

When importing via Firewire the it creates DV files.  Back in 2011 one of my main things was for the Karvanek Conspiracy video files, I wanted to master them all in the new webm format, because I like to torture myself with bleeding edge technology and paint myself into a corner like I did with the Real Media.  This worked out great, but it was a fairly slow process of hand writing all the times for where to stop and start the webm encoding process.  I was using WinFF which is a Windows GUI for ffmpeg.  And I would do command line encoding using the latest version of ffmpeg at that time. Everything worked like a champ. Other than encoding in webm is insanely slow.

But, that is no longer the case now.  Trying WinFF and straight ffmpeg and any application that uses ffmpeg will now fail to encode DV video files that I am creating because the DV files will record tape drop outs and other events (like stopping and starting recording) as some sort of odd or error frame.  When ffmpeg detects these frames it will spit out a bunch of EOB errors and stop encoding. ffmpeg, WinFF, Xmedia Recode, Handbrake all succumb to this problem.  The only encoder I had installed on my computer was Microsoft Expression Encoder 3.  It was part of the whole Microsoft Expression suite as I use Expression Web to do HTML editing.  It is a real good encoder, it will do VC-1, H.264 and Smooth Streaming.  I’ve been encoding everything now in MP4 format and Expression Encoder 3 worked great, but it was slow. It would take an hour to encode 30 minutes of video.

I wasted a good day figuring out the problem with DV files and ffmpeg and realizing it was hopeless unless I wanted to patch the source code on a Linux box and do all my encoding on that.  Which seemed kind of retarded, wait, that is retarded.  This whole issue is retarded.  So I finally started looking into other encoder programs.  I found one that works like a champ with my DV files converting to MP4 and it will do WebM as well, but I haven’t tested it out yet.  It’s called Xilisoft Video Converter Ultimate.  It’s only about $50 at the time of this post. It’s worth the cost just in the time you will save searching total retarded non-sense.  The big surprise about this software is not that it worked converting the DV files, but it has code for both Nvidia and ATI graphics cards that will speed up MP4 encoding. The 30 minutes DV file that took an hour to convert using the old Expression Encoder 3, takes Video Converter Ultimate just about 5 minutes on my AMD A10 APU.  If you have a higher end graphics card I can imagine that time will go down considerably. So now my bottleneck is the actual importing of the video tapes and uploading them to You Tube.

The Super Fucking Ultra Shitty editor that comes with BlogEngine.Net refuses to allow me to enter a link over the Xilisoft name. You know, let’s make a blog application for Microsoft’s web server and go out of our way to make it not work with Internet Explorer.  So here is the manually typed in link; http://www.xilisoft.com/

 

 

Categories
Other

Will technology keep our past in the present?

There soon will be an entire generation that grew up in the age of online.  Everything they did in the past will still be with them in the present and into their future.  Middle aged people are now facing their children becoming adults, but what did all the middle aged people and their parents do to preserve the past?

Previously people have used photography as a means to preserve the past.  You would take yearly Christmas photos, the classic photo op on summer vacations.  For many years it was film based photography, which had it’s limits in the cost of the film and then developing the exposed film. This created an artificial scarcity due to the cost. You would treasure those moments and make them special by taking a photograph. Film wasn’t as popular, but it was readily available.  They were available for film but it was cumbersome, not very good, no sound, and expensive.  This limited the use and created an even greater scarcity of home movies.  The first great leap forward for this type of past preservation was the release of video tape recorders and home market cameras.  These bulky devices were still in the realm of hobbyist type usage.  Then the home market video camera is unleashed. There is now an unprecedented amount of our past preserved on video tape.  Most of it was all ignored, pushed off into the closet, collecting dust or forgotten about.  Some, or perhaps a lot was over written or stored improperly to be forever in the past.

Is this what we really wanted when preserving the past?  To shove it off into a box to be forgotten?  People seem to have a tendency to create their own narrative of their life, whether it reflects reality or not. It’s just part of how we work. When we relive the past and then see what we were, that may change or bend the narrative we’ve created for ourselves.  How our reaction to it will be different for everyone’s experience and how their experience put them on their path.  It’s those gaps of time from the past to the present that gives us this reflection. Now can you imagine, no gap from the past to the present?

There is an emerging generation that has grown up entirely with the Internet and it’s massive ability to preserve, everything.  How will this and the preceding generations deal with this shift in how our past is preserved?

Categories
Other

I don’t have time for your bullshit

I was talking with a friend today about how we are at an age where there is nothing that she wants to buy that she finds interesting or cool anymore.  As we were bantering back and forth with our nonsense, that idea kept creeping in my old and busted mind.  I had been encoding 20 year old VHS and 8mm video tapes onto my computer and uploading them to YouTube for the past couple of days.  I had begin to notice how I was first and foremost an asshole when I was younger. But, another aspect of the idea that, I didn’t know any better then.

Hindsight sure is 20/20, maybe even more clearer as you age.  My friend and I couldn’t really figure out what new and cool gadget would actually be useful.  When we were younger, we would spend inordinate amounts of money on complete nonsensical bullshit.  Were all these new gadgets and stuff we spent time and money on training us to finally come to the realization that it’s just all a bunch of crap?  Was it’s some sort of panacea for us? Or was it to pacify ourselves into self assuredness?  Now that we are 20 years older we see the man behind the curtains and all the crap for what it really is; It’s crap.

I feel weary about so much push to consume, consume and consume some more.  The new promising technology of 3D object printers sounds like a great idea. But what do I need a 3D Printer for? To print out more plastic trinkets? I already have so much plastic useless trinkets already, do I need more?  This is where my age is either against me, or as I said earlier, the curtain has been revealed and I see it for what it really is. Bullshit.

Welcome to Costco. I love you.