View SWF files on Linux.

Source: Internet
Author: User
Tags python script

Look at the SWF file on Linux, originally want to use Gnash to see, but some computer see only sound, no image

So use the page to view, recommend Google

We are in the same directory as the Flash file to create a new file named: index.html

Note: The name can be arbitrary, but the suffix must be HTML page file


Using Gedit to open the file, copy the following HTML tag:

<embed src= "./kofwing_1-4.swf" width= "100%" height= "550px"/>

which

SRC: Represents the path to the SWF file

Width: Table Video width

Height: Table Video Height

Height and width can be customized according to your own flash aspect

But my swf file too many, one of the writing is more troublesome, so wrote a py script automatically generated

First, use the shell command to redirect the filename to a file

Write a py file,

The directory structure is

All you need to do is move the 2.txt here, and then write a 1.py.

1.py file

#!/usr/bin/env python#-*-coding:utf-8-*-#@Time: 18-6-6 pm 6:53#@Author: LK#@File: 1.py.py#@Software: Pycharm"""Linux Web page view swf file, because there are a lot of SwF files, one to change the trouble so write a Python script automatically generated"""ImportOs,shutilImportFileinputdata=[]os.makedirs ('Mk')#Create a folder to hold the generated files#reads the contents of a file by line and saves it to the list forLineinchFileinput.input ("2.txt"): Data.append (line) forLineinchData:" "takes the contents of each line as the file name, and adds the contents of each row to the new file" " Line= Line.replace ('. swf',"') Content='<embed src= ". /'+ Line +'. swf "width=" 100% "height=" 700px "/>' Line+=". html" Line= Line.replace ("\ n","')#remove the line break at the end of the stitchFP= Open (line,'W')#Create a filefp.write (content) Fp.close () Shutil.move (line,"./mk/")#Moving Files

This file is created in the Mk directory so that after the

<embed src= "./kofwing_1-4.swf" width= "100%" height= "550px"/>

Name kofwing_1-4 replace it with your file name notice I'm here. /indicates Upper directory

The contents of the Mk directory generated are:

HTML file content,

Then place the Mk directory in the same directory as the SWF file

Just open it in a browser.

Some can not open, just change an HTML file name on the line

View SWF files on Linux.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.